➤ Program to print " Hello world ! "
#include <stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
OUTPUT :
Hello world
➤ Program to convert Integer to floating point number .
#include<stdio.h>
int main()
{int a;
float b;
printf("enter integer point number:");
scanf("%d",&a);
b=(float)a;
printf("converting integer to float number is %f ",b);
return 0;
}
OUTPUT :
enter integer point number:45
converting integer to float number is 45.000000
➤ Program to convert Floating to Integer point number .
#include<stdio.h>
int main()
{float a;
int b;
printf("Enter floating point number: ");
scanf("%f",&a);
b=(int)a;
printf("converting float to integer number is %d ",b);
return 0;
}
OUTPUT :
enter floating point number: 5.6
converting float to integer number is 5
➤ Program to find size of data type.
#include<stdio.h>
int main()
{
printf("Size of int:%d bytes\n",sizeof(int));
printf("Size of float:%d bytes\n",sizeof(float));
printf("Size of char:%d bytes\n",sizeof(char));
printf("Size of double:%d bytes\n",sizeof(double));
return 0;
}
OUTPUT :
Size of int:4 bytes
Size of float:4 bytes
Size of char:1 bytes
Size of double:8 bytes
➤ Program to print the one's place number .
#include<stdio.h>
int main()
{int num,digit;
printf("Enter any number:");
scanf ("%d",&num);
digit=num%10;
printf("The digit at one's place of %d is %d",num,digit);
return 0;
}