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
why we wont use '&' sing in aceesing the string using scanf
write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?
How does #define work?
What is echo in c programming?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
What is hash table in c?
If you know then define #pragma?
What is the benefit of using const for declaring constants?
What is the use of in c?
What is spaghetti programming?
What are different types of variables in c?
What is "Hungarian Notation"?
how do you programme Carrier Sense Multiple Access
What is the difference between int main and void main in c?
Write a program to print numbers from 1 to 100 without using loop in c?