Write a programm such that
if user enter 11.25 it roundup to 11
but if user enter 11.51 upto 11.99 it will round up to 12
i.e.;convert the floting point value into integer format as
explain above..
Answer Posted / vadivel t
#include<stdio.h>
#include<math.h>
void main()
{
double no = 12.34, no1, intpart;
no1 = modf(no, &intpart);
if(no1 >= 0.5)
{
printf("ROUNDED VALUE: %f",++intpart);
}
else
{
printf("ROUNDED VALUE: %f",intpart);
}
_getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is array within structure?
Write a Program to accept different goods with the number, price and date of purchase and display them
What are structure members?
What is n in c?
hi send me sample aptitude papers of cts?
What is typedef struct in c?
what does static variable mean?
Explain function?
How do we print only part of a string in c?
How would you rename a function in C?
Explain how can you avoid including a header more than once?
How can I make sure that my program is the only one accessing a file?
What is unsigned int in c?
Are global variables static in c?
What is bash c?