answersLogoWhite

0


Best Answer

well major difference between scanf and printf is that scanf is an input statment and printf is an output stament scanf is used to take data in from the user and printf is used to display the result on the screen Regards

User Avatar

Wiki User

15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between the printf and scanf statements in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is a purpose of printf and scanf statements?

we write printf() b/c it printf or show us the value contained in a value on the screen after pressing ctrl+f9.


Can you use scanf function within printf function?

Yes: double d; printf ("scanf's just returned %d\n", scanf ("%lf", &d));


What is the full form of printf or scanf?

int printf (const char *fmt, ...)orint scanf (const char *fmt, ...)


Is printf and scanf overloaded?

No, they are variadic.


What is the use of printf and scanf function?

Printf prints something to the standard output stream, and scanf inputs something from the standard input stream.


How do you make a program in C using do-while loop?

do statement; while (condition);ordo { statements } while (condition);


Write a program in C programming language to prepare the mark-list of six subjects using if-else statements?

#include<stdio.h> #include<conio.h> void main() { char name[100][100]; //array of strings int roll[100],English[100],maths[100],tamil[… clrscr(); printf("Enter the number of students"); scanf("%d",&n); for(i=1;i<=n;i++) { printf("Enter the name of student no %d :",i); scanf("%s",name[i]); printf("Enter the roll number of student %s :",name[i]); scanf("%d",&roll[i]); printf("Enter the English mark of student %s :",name[i]); scanf("%d",&English[i]); printf("Enter the maths mark of student %s :",name[i]); scanf("%d",&tamil[i]); printf("Enter the science mark of student %s :",name[i]); scanf("%d",&science[i]); printf("Enter the maths mark of student %s :",name[i]); scanf("%d",&maths[i]); clrscr(); } for(i=1;i<=n;i++) { printf("\nName: %s \nRoll No: %d \n",name[i],roll[i]); printf("English :%d \nTamil:%d \nscience: %d \nmaths:%d",English[i],tamil[i],science[… } getch(); }


What does printf and scanf return?

Printf returned no. of character receive . scanf return no of variable to be inputed according to format specifier . eg: i=printf("thisisc") printf("%d",i); //i=7 j=scanf("dd",&a,&b,&c,&d); printf("%d",j); IT IS MOST APPROPRIATE ANSWER FOR THIS Q .......... PLZ DO Practically............


How many types of selection statements in c language?

there are two types of selection statements in c-language they are if-else and switch case.these two are known as selection statements,because their syntax is like this,if-else syntax:-if(condition){statements}else{statement}in the abow syntax it contains two blocks first one is if and second one is else in 'if' it fills with required condition if the condition is satisfied then it execute the if block,whether it is false it execute the else statements.switch case syntax:-switch(condition){case.1:statements;case.2:statements;case.3:statements;...case.n:statements;default:statement;}in abow switch case we can select any case and execute,in this selection statement gives the fiexibulity to the user.it contains default statement it shows the wrong selection in these cases.examples programs to these statements:-1.biggest of two numbers program?main(){int a,b,c;printf("enter a,b values");scanf(&a);scanf(&b);scanf(&c);if(a>b){printf("a is big");}else{printf("b is big");}}out put:-enter a,b values 8,5a is bigenter a,b values 3,9b is big2.perform arithmetic operation intwo numbers?main(){int a,b,c,d;printf("enter a,b values");scanf(&a);scanf(&b);scanf(&c);printf("enter your choice"&c);switch(c){case.1:d=a+b;printf("d value is"&d);case.2:d=a-b;printf("d value is"&d);case.3:d=a*b;printf("d value is"&d);default:printf("wrong selection");}}out put:-enter a,b values 6,5enter your choice 1d=11enter your choice 2d=1enter your choice 3d=30


How do you return to a main function?

..use do{} while{}..for example..#includemain(){int choose;double a,b,c;printf("Enter 7 if you want to use the calculator. Otherwise,type any character.\n");scanf("%d",&choose);do{if (choose==7){printf("Press 1 for addition.\n");printf("Press 2 for subtraction.\n");printf("Press 3 for multiplication.\n");printf("Press 4 for division.\n");scanf("%d",&choose);if (choose==1){printf("Enter the addends\n");scanf("%lf %lf", &a,&b);c=a+b,printf("The sum of %lf and %lf is %lf.\n",a,b,c);}else if(choose==2){printf("Enter the minuend and subtrahend\n");scanf("%lf %lf", &a,&b);c=a-b,printf("The difference of %lf and %lf is %lf.\n",a,b,c);}else if(choose==3){printf("Enter the multipliers\n");scanf("%lf %lf", &a,&b);c=a*b,printf("The product of %lf and %lf is %lf.\n",a,b,c);}else if(choose==4){printf("Enter the dividend and divisor\n");scanf("%lf %lf", &a,&b);c=a/b,printf("The quotient of %lf and %lf is %lf.\n",a,b,c);}else{printf("You have entered an invalid digit.\n");}printf("If you want to continue,press 7 and choose again from 1 to 4.\n");printf("Do you want to exit? Enter any key.\n");scanf("%d",&choose);}}while(choose==7);}


Can someone make write you a program that tells somebody their zodiac signs the program asks a person their year month and day they were born and it should be for the Chinese Zodiac and Western?

#include <stdio.h> #include<string.h> main() { char s[80]; int d; clrscr(); printf("enter the month of your birthday: "); gets(s); if(!(strcmp(s, "january"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=19) printf("\n CAPRICORN"); else printf("\n AQUARIUS"); } if(!(strcmp(s, "february"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=18) printf("\n AQUARIUS"); else printf("\n PISCES"); } if(!(strcmp(s, "march"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=20) printf("\n PISCES"); else printf("\n ARIES"); } if(!(strcmp(s, "april"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=19) printf("\n ARIES"); else printf("\n TAURUS"); } if(!(strcmp(s, "may"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=20) printf("\n TAURUS"); else printf("\n GEMINI"); } if(!(strcmp(s, "june"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=20) printf("\n GEMINI"); else printf("\n CANCER"); } if(!(strcmp(s, "july"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=22) printf("\n CANCER"); else printf("\n LEO"); } if(!(strcmp(s, "august"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=22) printf("\n LEO"); else printf("\n VIRGO"); } if(!(strcmp(s, "september"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=22) printf("\n VIRGO"); else printf("\n LIBRA"); } if(!(strcmp(s, "october"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=22) printf("\n LIBRA"); else printf("\n SCORPIO"); } if(!(strcmp(s, "november"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=21) printf("\n SCORPIO"); else printf("\n SAGITTARIUS"); } if(!(strcmp(s, "december"))) { printf("\n enter the date of your birthday: "); scanf("%i", &d); if(d<=21) printf("\n SAGITTARIUS"); else printf("\n CAPRICORN"); } getch(); }


Could you Write a C program to draw shapes Square?

main() {int nLength, nWidth, A, B; printf ("enter length: "); scanf ("%d", nLength); printf ("enter Width: "); scanf ("%d", nWidth); for(A=1;1<=nWidth;A++) printf ("*"); printf ("\n"); for (A = 2; A <= nLength -1; A++) printf ("*"); for (B = 2; B <= nWidth -1; B++) printf ("*"); printf ("\n");