Problem Statement
write a c program to convert a floating point number to integer by multiplying with 10 such that no any zero is remained in the end
#include<stdio.h>
int main()
{
int temp;
float n;
printf("enter the floating point number ");
scanf("%f",&n);
temp=n/1;
while(temp!=n){
n=n*10;
temp=n/1;
}
printf("%d \n",temp);
return 0;
}
write a c program to convert a floating point number to integer by multiplying with 10 such that no any zero is remained in the end
#include<stdio.h>
int main()
{
int temp;
float n;
printf("enter the floating point number ");
scanf("%f",&n);
temp=n/1;
while(temp!=n){
n=n*10;
temp=n/1;
}
printf("%d \n",temp);
return 0;
}
No comments:
Post a Comment