What will be the output of the following C code?
#include <stdio.h>
int main()
{
printf("examveda\r\nclass\n");
return 0;
}
#include <stdio.h>
int main()
{
printf("examveda\r\nclass\n");
return 0;
}
A. examvedaclass
B. examveda
class
C. classveda
D. examveda
Answer: Option B
correct answer should be option c
"examveda" followed by a carriage return (
), which moves the cursor to the beginning of the line, and then "class" will overwrite "exam" since it moves the cursor back to the beginning of the line.
"class" will be printed on the next line after "veda", resulting in the final output:
class
veda
veda in new line since there is an
after class