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 advantage of pointer in c?
What is data structure in c programming?
Can a variable be both const and volatile?
What are the functions to open and close the file in c language?
What is the advantage of a random access file?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
write a program to find out prime number using sieve case?
Why shouldn’t I start variable names with underscores?
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What are the different file extensions involved when programming in C?
What is indirection in c?
How do you determine a file’s attributes?
What is structure padding in c?
What does #pragma once mean?
What is the use of pragma in embedded c?