Ad

Chapter - 16: Miscellaneous Features

What will be the output of the following programs:


Ad
A
Sections
1
Exercises

(a)

#include<stdio.h>
int main()
{
	enum status {pass, fail, atkt};
	enum status stud1, stud2, stud3;
	stud1 = pass;
	stud2 = fail;
	stud3 = atkt;
	printf("%d %d %d\n", stud1, stud2, stud3);
	return 0;
}

Output: 0 1 2


(b)

#include<stdio.h>
int main()
{
	printf("%f\n", (float)(int)3.5 / 2);
	return 0;
}

Output: 1.0


(c)

#include<stdio.h>
int main()
{
	float i, j;
	i = (float)3 / 2;
	i = i * 3;
	printf("%d\n", (int)j);
	return 0;
}

Output: 4

Ad

© 2024 Garbage Valuegarbage value logo