[go: up one dir, main page]

0% found this document useful (0 votes)
11 views8 pages

Scanf - Input in C

The document discusses the scanf function in C programming which accepts input from the user using standard input. Scanf uses format specifiers like printf to accept different data types from the user such as integers, characters, strings and floats. An example is provided to demonstrate how to use scanf to accept two integer inputs from the user.

Uploaded by

roveenasyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Scanf - Input in C

The document discusses the scanf function in C programming which accepts input from the user using standard input. Scanf uses format specifiers like printf to accept different data types from the user such as integers, characters, strings and floats. An example is provided to demonstrate how to use scanf to accept two integer inputs from the user.

Uploaded by

roveenasyam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8

C Programming-scanf

1
2
What is scanf?

 Stands for scan formatted string


 Accept character, string and numeric data from the user
using standard input – Keyboard
 Scanf also use format specifiers like printf.
 For example
 %d to accept input of integer type
 %c to accept input of character type
 %s to accept input of string type
 %f to accept input of float type
 so on..
Example

 int VAR;

 scanf(“%d” ,&VAR);
Why &?
Why &?

&VAR
ADDRESS OF VAR
Example

#include<stdio.h>
int main()
{
int num1,num2;
printf(“Enter the value”);
scanf(“%d%d”,&num1,&num2);
printf(“the values are %d and %d”,num1,num2);
return 0;
}
8

You might also like