Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Program to read the numbers, round them off to the nearest integers and print out the results in integer form

Posted By: Bethany Hughes     Category: C Programming     Views: 10950

Write a program to read the following numbers,round them off to the nearest integers and print out the results in integer form : 35.7 50.21 -23.73 -46.45

Code for Program to read the numbers, round them off to the nearest integers and print out the results in integer form in C Programming

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
    float n;
    clrscr();

    printf("Enter the number:-");
    scanf("%f",&n);

    printf("The integer number after rounded is  %5.0f",n);
    getch();
}


/*
********
OUTPUT
********

Enter the number:-12.33

The integer number after rounded is 12

Enter the number:-12.55

The integer number after rounded is 13

*/
  
Share: 



Bethany Hughes
Bethany Hughes author of Program to read the numbers, round them off to the nearest integers and print out the results in integer form is from London, United Kingdom.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!