Program to take amount as Rupee and paise and print it as paise

79580
Program to take amount as Rupee and paise and print it as paise
#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.

 

Program to take amount as Rupee and paise and print it as paise in c c language Program to take amount as Rupee and paise and print it as paise Program to take amount as Rupee and paise and print it as paise in c Program to convert Rupee into paiseĀ Program to convert Rupee into paise in c language Program to convert the money Program to take amount as Rupee and paise and print it as paise estudyhelper Program to take amount as Rupee and paise and print it as paise coding.booksinhindi.com