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 we can insert comments in a c program?

0 Answers  


Explain the concept and use of type void.

0 Answers  


is it possible to change the default calling convention in c ?

1 Answers   Aptech,


Is c procedural or functional?

0 Answers  


What is 'makefile' in C langauage? How it be useful? How to write a makefile to a particular program?

2 Answers  


Explain threaded binary trees?

0 Answers  


what is the use of #pragma pack, wer it is used?

2 Answers   Wipro,


Just came across this question, felt worth sharing, so here it is I want you to make a C/C++ program that for any positive integer n will print all the positive integers from 1 up to it and then back again! Let's say n=5 I want the program to print: 1 2 3 4 5 4 3 2 1. Too easy you say? Okay then... You can ONLY USE: 1 for loop 1 printf/cout statement 2 integers( i and n) and as many operations you want. NO if statements, NO ternary operators, NO tables, NO pointers, NO functions!

1 Answers  


What are pointers in C?

5 Answers   KPIT,


The C language terminator is a.semicolon b.colon c.period d.exclamation mark

6 Answers   TCS,


What is bss in c?

0 Answers  


What are the 5 types of inheritance in c ++?

0 Answers  


Categories