#include<stdio.h>
#include<conio.h>
void main()
{
float rp;
int r,p;
clrscr() ;
printf("\n Enter amount \n") ;
scanf ("%f", &rp);
r=rp; /* assigns only integer part to r */
p=(rp-r)*100; /* fraction part is multiplied by 100 to get only 2 digits
as integer part */
r=r*100+p; /* total paise */
printf("\n total paise = %d\n",r);
getch();
}
Output:
Enter amount
12.50
Total paise = 1250
The following is an alternate to the above program. Here we are directly multiplying the float value by 100 and getting integer part to represent the paise for given rupee and paise.