C Programming Basics
Write a c program to display integer value
#include <stdio.h>
#include <stdlib.h>
int main()
{
int x=31;
printf("\n Display integer value:%d",x);
return 0;
}
output
Display integer value:31
Write a c program to display Float value
#include <stdio.h>
#include <stdlib.h>
int main()
{
float x=31.36;
printf("\n Display float value:%f",x);
return 0;
}
output
Display float value:31.360001
Write a c program to display character value
#include <stdio.h> #include <stdlib.h> int main() { char ch='c'; printf("\n Display character:%c",ch); return 0; }
output
Display character:c
write a program to input an integer value from keyboard and display on the screen
#include <stdio.h>
#include <stdlib.h>
int main()
{
int value;
printf("\n Enter integer value:");
scanf("%d",&value);
printf("\n Display integer value:%d",value);
return 0;
}
output
Enter integer value:3136
Display integer value:3136
write a program to input an float value from keyboard and display on the screen
#include <stdio.h>
#include <stdlib.h>
int main()
{
float value;
printf("\n Enter float value:");
scanf("%f",&value);
printf("\n Display float value:%f",value);
return 0;
}
output
Enter float value:31.36
Display float value:31.360001
write a program to input an character from keyboard and display on the screen
#include <stdio.h>
#include <stdlib.h>
int main()
{
char ch;
printf("\n Enter character:");
scanf("%c",&ch);
printf("\n Display character:%c",ch);
return 0;
}
output
Enter character:c
Display character:c
