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 |
How to access command-line arguments?
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }
How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)
main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
What are segment and offset addresses?
Write a program to implement the motion of a bouncing ball using a downward gravitational force and a ground-plane friction force. Initially the ball is to be projected in to space with a given velocity vector
#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }
main() { int i=-1,j=-1,k=0,l=2,m; m=i++&&j++&&k++||l++; printf("%d %d %d %d %d",i,j,k,l,m); }
main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above
main() { printf("%d, %d", sizeof('c'), sizeof(100)); } a. 2, 2 b. 2, 100 c. 4, 100 d. 4, 4
18 Answers HCL, IBM, Infosys, LG Soft, Satyam,
Who could write how to find a prime number in dynamic array?