Printf And Scanf Example Program In C Programming
Definition of Printf And Scanf :
scanf is a function that reads formatted data from stdin.h and then writes the results into the arguments given. The printf built-in function writes output to an implementation.
Synatx:
printf("Text to be displayed : %access_specifiers", variable);
scanf(const char *format, variable);
Example Program for Printf and Scanf:
/*##Printf And Scanf*/
/*##I/O Programs, Basic Programs*/
/*##Example*/
#include <stdio.h>
int main()
{
char ch;
char str[100];
printf(?Enter any character \n?);
scanf(?%c?, &ch);
printf(?Entered character is %c \n?, ch);
printf(?Enter any string ( upto 100 character ) \n?);
scanf(?%s?, &str);
printf(?Entered string is %s \n?, str);
}
Sample Output:
Enter any character
a
Entered character is a
Enter any string ( upto 100 character )
hai
Entered string is hai
Read More Articles
- Use of getch(),getche() and getchar() in C
- Switch Case Statement Example Program In C Programming Language
- C Character Set
- Convert a Floating-point value to an Integer in C
- Data Input and Output gets and puts Example Program In C
- Special Operators In C
- Pointer Representation and Pointer Example Programs
- C Data Input and Data Output
- Simple While Loop Example Program In C Programming Language
- Data Output printf and putchar Example Program In C
- C Introduction
- C Operators
- Storage Classes In C
- C Pointers
- File Management
- C Identifiers
- Loop Control Statements
- Hello World - Simple C Program
- C Array
- Single Character Output Function : putchar()
- C Reserve Words
- C Specific Properties and Implementation
- If else Statement Example Program In C Programming Language
- If Statement Example Program In C Programming Language
- Confusing Array in C ( Array Representation and Initialization )