Notification texts go here Contact Us Click here

Basic C program examples for beginner's

Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated
  1. ➤ Program to print " Hello world ! "
  2.  
  3. #include <stdio.h>
  4.  
  5. int main() {
  6. printf("Hello, World!\n");
  7. return 0;
  8. }
  9.  
  10. OUTPUT :
  11.  
  12. Hello world
  13.  
  14. ➤ Program to convert Integer to floating point number .
  15.  
  16. #include<stdio.h>
  17.  
  18. int main()
  19. {int a;
  20. float b;
  21. printf("enter integer point number:");
  22. scanf("%d",&a);
  23. b=(float)a;
  24. printf("converting integer to float number is %f ",b);
  25. return 0;
  26. }
  27.  
  28. OUTPUT :
  29.  
  30. enter integer point number:45
  31. converting integer to float number is 45.000000
  32.  
  33.  
  34. ➤ Program to convert Floating to Integer point number .
  35.  
  36. #include<stdio.h>
  37.  
  38. int main()
  39. {float a;
  40. int b;
  41. printf("Enter floating point number: ");
  42. scanf("%f",&a);
  43. b=(int)a;
  44. printf("converting float to integer number is %d ",b);
  45. return 0;
  46. }
  47.  
  48. OUTPUT :
  49.  
  50. enter floating point number: 5.6
  51. converting float to integer number is 5
  52.  
  53. ➤ Program to find size of data type.
  54. #include<stdio.h>
  55.  
  56. int main()
  57. {
  58. printf("Size of int:%d bytes\n",sizeof(int));
  59. printf("Size of float:%d bytes\n",sizeof(float));
  60. printf("Size of char:%d bytes\n",sizeof(char));
  61. printf("Size of double:%d bytes\n",sizeof(double));
  62. return 0;
  63. }
  64.  
  65. OUTPUT :
  66.  
  67. Size of int:4 bytes
  68. Size of float:4 bytes
  69. Size of char:1 bytes
  70. Size of double:8 bytes
  71.  

  72. ➤ Program to print the one's place number .
  73. #include<stdio.h>
  1. int main()
  2. {int num,digit;
  3. printf("Enter any number:");
  4. scanf ("%d",&num);
  5. digit=num%10;
  6. printf("The digit at one's place of %d is %d",num,digit);
  7. return 0;
  8. }

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.