scanf() Use in C Language

scanf() Use in C Language:

(1) scanf() is used for entering input values

(2) Sample C language code and its output, as shown:

#include <stdio.h>
#include <conio.h>
 
int main()
{
int n;
printf(“Enter the value: “);
scanf(“%d”,&n);
printf(“Entered value is: %d”, n);
getch();
return 0;
}
Sample C language code for scanf

(3) After that go to the “Build” menu and select the “Build” option for publishing the code as shown.

use build option for publisshing the code

(4) After building the code, press the “Run” button, as shown.

run the scanf c programming code

(5) After pressing the “run” button, the output screen is opened, then enter the number and press the “Enter” button  (remember that entered number must be an integer because we have declared variable “n” which is an integer) as shown.

scanf c code first enter value

(6) After entering the value, the system gives the output value, as shown.

scanf code output value shown by system

C Language Syntax
Use printf() in C Language
Use of ASCII function in SQL
How to get Data from SQL View in Excel Sheet
How to Create Connection between Excel and SQL database
ASCII (Transact-SQL)– Microsoft Docs

Leave a Reply