A simple example to get input and display output in c language Syntax:
printf(" "); Anything inside double quotes "" displays message on console.
scanf(""); used to get input from user.
Example:
#include<stdio.h>
int main()
{
// First we declare variables for more details view "declaring c variables"
int number,
char character;
float decimal;
//Then we ask user to enter values
printf("\n Enter any integer value");// Displays the message
scanf("%d",&number);// Gets input from user
printf("\n Enter any decimal value");
scanf("%f",&decimal);
printf("\n Enter any character");
scanf("%c%",&character);
printf("\n Entered values are");
printf('\n Integer %d',integer);
printf('\n Decimal value: %f ',decimal);
printf('\n'Character :%c",character);
}
Output:
Enter any number:
123
Enter any decimal:
1.23
Enter any character:
a
Entered values are:
Integer: 123
Decimal:1.23
Character: a
Description:
In this example we are first displaying a message asking user to enter certain values of different types.
Then user enters values and values are displayed accordingly.
Two predefined functions "printf() and scanf()" are used.
printf() - To display data on screen.
scanf() - To get input from keyboard.
Description In marathi / เคฎเคฐाเค ीเคค เคตเคฐ्เคฃเคจ
เคฏा เคเคงเคฐเคฃाเคค เคเคชเคฃ console เคตเคฐ เคตेเค - เคตेเคเคณ्เคฏा เคช्เคฐเคाเคฐเคे เคถเคฌ्เคฆ เคिเคตा เค
ंเค (data) เคฒिเคนिเคฒेเคฒा เคเคนे.
เคถเคฌ्เคฆ เคिเคตा เค
ंเค เคเคธा keyboard เคเคกूเคจ เค्เคฏाเคा เคเคฃि screen เคตเคฐ เคฆाเคเคตाเคฏเคा เคนे เคฏा เคเคงाเคฐเคฃाเคค เคिเคคเคฒा เคเคนे.
เคฏा เคเคงाเคฐเคฃाเคค เคฆोเคจ functions "printf() เคเคฃि เคธ्เคॅเคจ्เคซ()" เคตाเคชเคฐเคฒे เคเคนे.
printf() - Screen เคตเคฐ เคाเคนी เคถเคฌ्เคฆ เคिเคตा เค
ंเค เคฒिเคนिเคฃ्เคฏा เคธाเค ी.
scanf() - Keyboard เคตเคฐूเคจ เคถเคฌ्เคฆ เคिเคตा เค
ंเค เคेเคฃ्เคฏ เคธाเค ी.
 
Comments