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..

Answers were Sorted based on User's Feedback



Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.9..

Answer / 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

Write a programm such that if user enter 11.25 it roundup to 11 but if user enter 11.51 upto 11.9..

Answer / gsrinivas

#include<sdtio.h>
#include<math.h>
void main()
{
float x;
int y;
printf("\n entere the no");
scanf("%f",&x);
y=ceil(x);
y=floor(x);
printf("\n %d",y);
}

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Interview Questions

How old is c programming language?

0 Answers  


I have one doubt. What does below statement mean? #define sizeof(operator) where operator can be int or float etc. Does this statement meaningful and where it can be used?

1 Answers  


write a program to find a given no. is divisible by 3 or not without using any arthimetic operators?

3 Answers   Broadcom, TCS,


What does it mean when a pointer is used in an if statement?

0 Answers  


What is a scope resolution operator in c?

0 Answers  


What is difference between structure and union with example?

0 Answers  


Why is c known as a mother language?

0 Answers  


Sir i need notes for structure,functions,pointers in c language can you help me please

0 Answers   TCS,


how to find turn around time in operating system?

3 Answers  


We can draw a box in cprogram by using only one printf();& without using graphic.h header file?

4 Answers   NIIT,


Where is c used?

0 Answers  


can any one provide me the notes of data structure for ignou cs-62 paper

0 Answers   Ignou,


Categories