Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is advantage of pointer in c?

1244


What is data structure in c programming?

1131


Can a variable be both const and volatile?

1190


What are the functions to open and close the file in c language?

1085


What is the advantage of a random access file?

1253


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.

2023


write a program to find out prime number using sieve case?

2139


Why shouldn’t I start variable names with underscores?

1119


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

2020


What are the different file extensions involved when programming in C?

1343


What is indirection in c?

1116


How do you determine a file’s attributes?

1134


What is structure padding in c?

1191


What does #pragma once mean?

1207


What is the use of pragma in embedded c?

1098