Posts

Showing posts with the label getchar()

C-programming Reading input

Image
C - Input & Output printf() ,scanf(),gets(),getchar(),puts() and putchar() scanf()   This  function reads formatted input from standard input (keyboard)  printf()  This  function sends formatted output to the standard output (screen) Example 1    C Integer Input/Output #include <stdio.h> int main () { int n ; printf ( "Enter an integer: " ); scanf ( "%d" ,&n ); //Reads intiger from keyboard to variable n printf ( "Number = %d" ,n ); //Prints the read value in output screen return 0 ; } getchar()  - This function is used to read single character  putchar() -This function is used to print single character Example 2  -getchar(),putchar() #include <stdio.h> int main () { char c ; printf ( "Enter character: " ); c = getchar (); printf ( "Character entered: " ); putchar ( c ); return ( 0 ); } gets...