C best coding questions with answer

(q) What will be output of the following program ?

 

#include"stdio.h"

void  main(){

long double a=55555;

clrscr();

printf("%.2LE,%.2Le",a);

getch();

 

}

 

output:5.56E+04,5.56e+04

%e or %E represent print the number in exponential format.

%e means output has small letter e.

%E means output has capital letter e.

 

(q) What will be output of the following program ?

 

#include"stdio.h"

void  main(){

signed a=5;

unsigned b=5;

clrscr();

if(a==b)

printf("EQUAL");

else

printf("UNEQUAL");

getch();

 

}

 

output:Equal

Explanation: before any arithmetic operation small data type convert into higher data type i.e signed to unsigned.

No comments: