Print Character C Program

This is simple C Program to display character on the screen. %c is used to display a character. To display  integer, we use %d. To display floating point number, we use %f. To store character in a variable, we use apostrophe.

#include<stdio.h>
int main()
{
 char ch='a';
 printf("Character is %c \n",ch);
 return 0;
}


Here is another program to get input from keyboard and display it on the screen.
#include<stdio.h>
int main()
{
 char ch;
 printf("Enter a charcter: ");
 scanf("%c",&ch);
 printf("Character is %c \n",ch);
 return 0;
}





Popular posts from this blog