Tuesday, 8 March 2011

Beginning with C:1st example

Write a program to convert Rupees (float) to paisa (int).
#include<stdio.h>
#include<conio.h>
int main()
{
float rs; //real variable for rupees
int ps; // integer variable for paisa
clrscr();
printf("\n\n Enter rupees to convert into paisa : ");
scanf("%f",&rs);
ps=rs*100;
printf("\n Paisa of given rupees is %d",ps);
getch();
return 0;
}
Output:
Enter rupees to convert into paisa : 98.52
Paisa of given rupees is 9852

No comments:

Post a Comment