Input and output functions in C


The input and output functions are printf(), scanf(), getchar(), putchar(), gets() and puts() . The getchar() and putchar() are used to input and output single characters. The gets() and puts() function is used to input and output strings. The printf() and scanf() function are transfer of single characters, numerical values and strings.

When we say Input, it means to feed some data into a program. An input can be given in the form of a file or from the command line. C programming provides a set of built-in functions to read the given input and feed it to the program as per requirement.

When we say Output, it means to display some data on screen, printer, or in any file. C programming provides a set of built-in functions to output the data on the computer screen as well as to save it in text or binary files

Source Code

//Input and output functions in C Programming
 
#include<stdio.h>
int main()
{
    int a;
    char c;
    char name[50];
    printf("\nEnter The Value of A : ");
    scanf("%d",&a);
    printf("\n A : %d",a);
    printf("\nEnter The Character : ");
    fflush(stdin);
    c=getchar();
    putchar(c);
    printf("\nEnter Name: ");
    fflush(stdin);
    gets(name);
    puts(name);
    return 0;
}
 
To download raw file Click Here

Output

Enter The Value of A : 23

 A : 23
Enter The Character : s
s
Enter Name: sam
sam

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C