answersLogoWhite

0

What does printf and scanf return?

Updated: 8/11/2023
User Avatar

Wiki User

15y ago

Best Answer

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............

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

16y ago

scanf() (see "man 3 scanf") returns an integer signifying how many items were matched and read. It has the side effect of actually doing the reading and assigning of these values.

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

The return type of scanf() is an int that indicates how many fields were processed or the value EOF that indicates that end-of-file was encountered.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What does printf and scanf return?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the full form of printf or scanf?

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


Write c program to find multiplication of three numbers?

#include<stdio.h> #include<conio.h> void main() { int a,b,c; int Result; printf("enter the value of a:"); scanf("%d", &a); printf("enter the value of b"); scanf("%d", &b); printf("enter the value of c"); scanf("%d", &c); Result=a*b*c; printf("%d", Result); getch(); }


Program to perform Fibonacci search in c language?

#include<stdio.h> int main(){ int a[10],i,n,m,c=0; printf("Enter the size of an array: "); scanf("%d",&n); printf("Enter the elements of the array: "); for(i=0;i<=n-1;i++){ scanf("%d",&a[i]); } printf("Enter the number to be search: "); scanf("%d",&m); for(i=0;i<=n-1;i++){ if(a[i]==m){ c=1; break; } } if(c==0) printf("The number is not in the list"); else printf("The number is found"); return 0; }


Write a program in c to find the area of rectangle using array?

#include<stdio.h> #include<conio.h> #include<math.h> void main() { float len,bre,area; clrscr(); printf("\n\n\t\tEnter the length of the rectangle=\t"); scanf("%d",&len); printf("\n\n\t\tEnter the breadth of the rectangle=\t"); scanf("%d",&bre); printf("\n\n\t\tArea of the rectangle=\t%3f",area=l*b); getch(); }


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);}

Related questions

What is the difference between the printf and scanf statements in C?

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


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 c program to find multiplication of three numbers?

#include<stdio.h> #include<conio.h> void main() { int a,b,c; int Result; printf("enter the value of a:"); scanf("%d", &a); printf("enter the value of b"); scanf("%d", &b); printf("enter the value of c"); scanf("%d", &c); Result=a*b*c; printf("%d", Result); getch(); }


Program to perform Fibonacci search in c language?

#include<stdio.h> int main(){ int a[10],i,n,m,c=0; printf("Enter the size of an array: "); scanf("%d",&n); printf("Enter the elements of the array: "); for(i=0;i<=n-1;i++){ scanf("%d",&a[i]); } printf("Enter the number to be search: "); scanf("%d",&m); for(i=0;i<=n-1;i++){ if(a[i]==m){ c=1; break; } } if(c==0) printf("The number is not in the list"); else printf("The number is found"); return 0; }


Write a program in c to find the area of rectangle using array?

#include<stdio.h> #include<conio.h> #include<math.h> void main() { float len,bre,area; clrscr(); printf("\n\n\t\tEnter the length of the rectangle=\t"); scanf("%d",&len); printf("\n\n\t\tEnter the breadth of the rectangle=\t"); scanf("%d",&bre); printf("\n\n\t\tArea of the rectangle=\t%3f",area=l*b); getch(); }


Write a program in C language to find out the dot product of two vector quantities in Cartesian?

#include <stdio.h> #include <ctype.h> #define n[] int main() { int n, result , answer; int a[n], b[n]; printf("Enter number of terms you would like to use :"); scanf("%d", &n); printf("Enter first vector:\n"); scanf("%d", &a[n]); printf("Enter second vector:\n"); scanf("%d", &b[n]); printf("The dot product is \n" ); return 0; }


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(); }