In this program we have to set limit ( How many number should present after point (.) ) .

if we have to add two floating number 2.0 and 4.0 then when we add in compiler

the ans is 6.0000 but we want only 6.0 then we have to set limit . So for set limit in printing statement we have to write (%0.0f) when we want no any number after point .(% 0.1f) if we want one number after point.(%0.2f) for two and so on.

example:-

4.000 is a floating value in this after point there are 3 zero but we want only one then we have to fix number after point.

example 2:-if we have to add two floating number 2.0 and 4.0 then when we add in compiler

the ans is 6.0000 but we want only 6.0 then we have to set limit . So for set limit in printing statement we have to write (%0.0f) when we want no any number after point .(% 0.1f) if we want one number after point.(%0.2f) for two and so on.

#include<stdio.h>

void main()

{

float a,b,sum;

scanf("%f%f",&a,&b);

sum=a+b;

printf("%0.1f",sum);

}

## 2 Comments

Nyc one

ReplyDeleteà¤¬à¤¹ुà¤¤ à¤¬à¤¢़िà¤¯ा à¤—ुà¤°ुà¤¦ेà¤µ

ReplyDelete