what is the output of the below program & why ?
#include<stdio.h>
void main()
{
int a=10,b=20,c=30;
printf("%d",scanf("%d%d%d",&a,&b,&c));
}
Answers were Sorted based on User's Feedback
Answer / gaurav sharma
because printf returns the number of printed arguments .here
3 arguments taken ,the concept is ( scanf also return the
number of arguments so 3 returned to printf .m gaurav
sharma ,,,,,works in aricent.
Is This Answer Correct ? | 8 Yes | 0 No |
Answer / vibekananda dash
dear selvam,
its showing o/p,
its ask for entry and it accept ur entry,
o/p is -
i entered
1
press enter 2
press enter 78
press enter 3.
my question is why its showing 3.
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / kalyani
The answer is 3 because scanf returns no of arguments
Is This Answer Correct ? | 5 Yes | 1 No |
for Gcc compiler the code is producing error infact DevC++ just crashed . But using ANSI turbo C++ Ans is 3 ,
As the number of parameters in the printf() function is 3
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / selvam
this program contain no error and it will not give any output...
Is This Answer Correct ? | 4 Yes | 5 No |
There are 21 people in a room. They have to form groups of 3 people each. How many combinations are possible? Write a C program to print the same.
A program that will create a movie seat reservation. The program will display the summary seats and its status. The user will be ask what seat no. to be reserved, then it will go back again to the summary to display the updated seat status. If the seat no. is already reserved then it will prompt an error message. And also if the input seat no is out of range then it will also prompt an error message. The program is continuously running. Termination of the program will depends on how the programmer will apply. Sample output: Movie Seats Reservation Summary of Seats: Seat 1: Available Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 6 The Seat no. is out of range! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 1 The Seat no. is already reserved! Movie Seats Reservation Summary of Seats: Seat 1: Reserve Seat 2: Available Seat 3: Available Seat 4: Available Seat 5: Available Enter seat no. (Press 0 to terminate Or the assigned seat capacity) : 0 GoodBye... Thank You!!!
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }
Printf can be implemented by using __________ list.
Is the following code legal? struct a { int x; struct a b; }
main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above
Write a c program to search an element in an array using recursion
4. Main() { Int i=3,j=2,c=0,m; m=i&&j||c&I; printf(“%d%d%d%d”,I,j,c,m); }
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p
Is this code legal? int *ptr; ptr = (int *) 0x400;
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }
#include <stdio.h> int main(void) { int a=4, b=2; a=b<<a+b>>2 ; printf("%d",a); return 0; }