Wednesday 21 December 2011


TO ROUND AN INTEGER TO ITS NEAREST TENTH AND HUNDREDTH




To round of an integer to its nearest tenth and hundredth
#include<stdio.h>
Void main()
{
Int number,tenth,hundredth;
Clrscr();
Printf(“enter the number”);
Scanf(“%d”,&number);
Tenth=((number+5)/10)*10;
Hundredth=((number+50)/100)*100;
Printf(“%d can be rounded to the nearest tenth as %d\n”,number,tenth);
Printf(“%d can be rounded to the nearest hundredth as %d”,number,hundredth);
Getch();
}

No comments:

Post a Comment