C Programming language

C Programming Language: Input and Output Function
Previous Home Next

printf() Function

This is one of the most frequently used functions in C for output.

#include <stdio.h>
main()
{
	int num = 5;
	char str[] = "mini";
	char ch = 's';
	float pi = 3.14;
	printf("%d %s %f %c\n", num, str, pi, ch);
}

 

Scanf() Function

This is one of the most frequently used functions in C for intput.

#include <stdio.h>
main()
{
	int num ;
	char str[] = "mini";
	char ch = 's';
	float pi = 3.14;
	printf(“enter the value of num”);
	scanf(“%d”,&num); // take the value of num as input 
	printf("%d %c %f", num,str,pi); // print the values of num,str,pi,ch
}
Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: