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 array within structure?

1131


Write a Program to accept different goods with the number, price and date of purchase and display them

6240


What are structure members?

1097


What is n in c?

1065


hi send me sample aptitude papers of cts?

2169


What is typedef struct in c?

1058


what does static variable mean?

1118


Explain function?

1098


How do we print only part of a string in c?

1032


How would you rename a function in C?

1048


Explain how can you avoid including a header more than once?

1096


How can I make sure that my program is the only one accessing a file?

1283


What is unsigned int in c?

1009


Are global variables static in c?

1176


What is bash c?

1018