main()

{

int i;

printf("%d",scanf("%d",&i)); // value 10 is given as
input here

}

Answers were Sorted based on User's Feedback



main() { int i; printf("%d",scanf("%d",&i)); // ..

Answer / susie

Answer :

1

Explanation:

Scanf returns number of items successfully read and not 1/0.
Here 10 is given as input which should have been scanned
successfully. So number of items read is 1.

Is This Answer Correct ?    24 Yes 1 No

main() { int i; printf("%d",scanf("%d",&i)); // ..

Answer / keerthi

1

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Code Interview Questions

main() { float f=5,g=10; enum{i=10,j=20,k=50}; printf("%d\n",++k); printf("%f\n",f<<2); printf("%lf\n",f%g); printf("%lf\n",fmod(f,g)); }

1 Answers  


Write a program to receive an integer and find its octal equivalent?

7 Answers  


C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }

1 Answers  


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,






write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


main() { int a[10]; printf("%d",*a+1-*a+3); }

1 Answers  


Is this code legal? int *ptr; ptr = (int *) 0x400;

1 Answers  


#include<stdio.h> main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }

1 Answers  


main( ) { int a[2][3][2] = {{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}}; printf(“%u %u %u %d \n”,a,*a,**a,***a); printf(“%u %u %u %d \n”,a+1,*a+1,**a+1,***a+1); }

2 Answers  


Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.

5 Answers   Amazon, Microsoft,


main() { char str1[] = {‘s’,’o’,’m’,’e’}; char str2[] = {‘s’,’o’,’m’,’e’,’\0’}; while (strcmp(str1,str2)) printf(“Strings are not equal\n”); }

1 Answers  


Categories