Input and Output in C

So, here is how to take input and show output to the user.

printf();

printf is a function that is used display desired output to the user.

printf is a function of <stdio.h> header file, yes, we include this file to include standard input output features, and printf and scanf are part of it.

Example:

printf(“Hello Bro!”);

Ouput:

Hello Bro!

Remember that if you want to show your desired sentence in printf command, you have to write it in ” “.

Their is a big reason why we write the sentence in ” “.

scanf();

As printf is used to show output, scanf is used to get input.

Example:

int a;

printf(“Enter age :”);

scanf(“%d”,&a);

Output:

Enter age

19

Till now, just remember that scanf have two parts, one in ” “, and the other were we use variables, we will deeply understand this topic after you get to know what is a varible.

Published by Yash Kukreja

I am more than a proGrammer();

Leave a comment

Design a site like this with WordPress.com
Get started