Answer:
E. None of the above
Explanation:
char ans[20]
int num = 40;
sprintf(ans, "%d to %d", num, num +10);
This code fragment produce an error,because in 1st line of code char ans[20] ,there is no semicolon after the line.As ans is undeclared ,the ide will produce an error as we use it in
sprintf(ans, "%d to %d", num, num +10);
If we put semicolon after the char ans[20] ,then it will not give error but also don't produce an output because for sprintf we should initialize the num and ans as of pointer type.
It is a condition for sprintf and num should be of string type.
C program
#include <stdio.h>
int main()
{
char ans[20];
int num = 40;
sprintf(ans, "%d to %d", num, num +10);
return 0;
}
Output
No output
(You can check this code on any ide for confirmation.)