Write a program to read the price of an item in decimal form and print the output in paise.
The program is to read the price of an item in decimal form like 15.95 and print the output in paise like 1595 paise.
#include<stdio.h> main() { float n; int sum; printf("Enter the value in decimal "); scanf("%f",&n); sum = 100 * n; printf(" \nThe paise is %d.", sum); getch(); return 0; }
Output :
Enter the value in decimal 15.95 The paise is 1595.
#include
ReplyDeleteint main()
{
float price;
int r,p,t;
printf("Enter the price");
scanf("%f",&price);
t=price*100;
r=t/100;
p=t%100;
printf("%d Rupee and %d paisa",r,p);
return 0;
}
54.70
Delete