#include<stdio.h>
#include<conio.h>
int main(void) {
int a,b,c;
printf("write three numbers:\n");
scanf("%d %d %d", &a,&b,&c);
printf("You entered %d , %d and %d",a,b,c);
getch();
}
scanf is a function, not a statement. Example: int a; char name[12]; scanf ("%d %s", &a, &name[0]);
scanf: scanf is a built-in function to read input from the user.
scanf() is an input function which reads input from the standard input devices such as keyboard. Syntax: scanf("Control Character",address_list); where control character is a sequence of one or more character such as %d,%f,%lf,%lld. Address list specifies the variables, pointers etc. e.g. scanf("%d",&num);
Use the scanf() function from the C standard library.
printf(\n "ENTER THE NUMBER\t"); scanf{"%d",&a); while(a!=0); { r=a%2; if(r==0) printf("\n\n THE NUMBER IS EVEN \t"); else printf("\n\n THE NUMBER IS ODD \t"); printf ("\n ENTER THE NUMBER \t"); scanf("%d",&a); } getch(); }
scanf is a function, not a statement. Example: int a; char name[12]; scanf ("%d %s", &a, &name[0]);
scanf();
By using the scanf statement in c,we can take the values at run time . for ex a is a variable of type int so, we can assign the value of a using scanf at run time as follows. scanf("%d",&a); here %d is the conversion specifier for integer type.
It's a function, not a statement. Use your help system to find out its purpose.
scanf: scanf is a built-in function to read input from the user.
scanf() is an input function which reads input from the standard input devices such as keyboard. Syntax: scanf("Control Character",address_list); where control character is a sequence of one or more character such as %d,%f,%lf,%lld. Address list specifies the variables, pointers etc. e.g. scanf("%d",&num);
#include <stdio.h> int main(){ int a,b scanf("%d",&a); scanf("%d",&b); a=a+b; printf("%d",a); return 0; } Hope this can help you ☺
Use the scanf() function from the C standard library.
printf(\n "ENTER THE NUMBER\t"); scanf{"%d",&a); while(a!=0); { r=a%2; if(r==0) printf("\n\n THE NUMBER IS EVEN \t"); else printf("\n\n THE NUMBER IS ODD \t"); printf ("\n ENTER THE NUMBER \t"); scanf("%d",&a); } getch(); }
Hiii,scanf() is an predefined function of C to getting runtime input from the user.Syntax:-scanf("sequence specifier",&variable_name);example:-#includevoid main(){int number;printf("\n Enter any number"); //message to userscanf("%d",&number); //getting input from userprintf("\n entered number is %d",number); // displaygetch();}
Simple press the keys one by one, end finally press Enter.But if you meant: how the read from keyboard, then use functions like fgets or scanf. (Use the help/manual of your system for details.)
#include <cstdio> int main() { int x[10]; printf("Enter 10 integers: \n"); for(int i = 0; i < 10; i++) { scanf("%d", &x[i]); } for(int i = 0; i < 10; i++) { printf("%d, ", x[i]); } char wait; scanf("%s", wait); return 0; }