Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

N o te s

Prepared by Muhammad Bilal


Seek Knowledge Academy
Prepared by Muhammad Bilal

8)
a) Show how the value -17.246 would be printed using the formate
%8.4f, %8.4f, %8.3f, %8.2f, %8.1f, %8.0f and %0.2f
ANS:
FORMAT
OUTPUT
%8.4f
-17.2460
%8.3f
-17.246
%8.2f
-17.25
%8.1f
-17.2
%8.0f
-17
%0.2f
-17.25
b) Assuming x(type double) is 21.335 and y (type int) is 200,show
the output of the following statement on paper. for clarity show
the symbol
to donate a blank space.
Printf (x is %6.2f \t y is %4d\n,x,y);
Printf (y is%d\n, y);
Printf (x is %1f\n,x);
OUTPUT
X is
21.34
y is 200
Y is 200
X is 21.3
c) If the variable a,b and c are 307, 408.558 and -12.31
respectively write a statement that will display the following
line(the symbol
show a blank space?
307
408.56
-12.3
ANS:
Printf (%fd%11.2f%9.1f,a,b,c);
9) Write a program that asks the user to enter the radius of the circle and then
compute and display the circle area. Use this formula
Area =P1 X Radius X Radius
ANS:
#include<stdion.h>
#include<conio.h>
#define PI 3.14159
Void main (void)
{
}

You might also like