Rounding off a Floating Point Number

Problem Statement
Write a C program to round off a decimal number
#include<stdio.h> int main() { int y; float n; printf("enter the number \n"); scanf("%f",&n); n=n+.5; y=(int)n; printf("roundeed figure id %d\n",y); return 0; }

No comments:

Post a Comment