A C Program to ask the price of an item in decimal and separate rupees and paise.


                                         
#include<stdio.h>
#include<conio.h>
void main()

{
float price,rs,paise,z;
clrscr();
printf("Enter price of an item:");
scanf("%f",&paise);
z=price*100;                                      //Converting price in paise..
rs=z/100;                                           //Dividing that paisa by 100 will give Rupees.
paisa=z%100;                                    //Modulo by 1oo will give paise.
printf("Rupees:%f",rs);
printf("Paise:%f",paise);
getch();
}

Comments

  1. this code doesn't works...

    prog.c:2:18: fatal error: conio.h: No such file or directory
    #include
    ^
    compilation terminated.

    ReplyDelete
  2. Replies
    1. float pe kabhi modules funtion kaam nhi krta

      Delete
    2. his idea is correct but the code is wrong
      try this one
      #include
      int main()

      {
      float price,rs,paise;
      int a;
      printf("Enter price of an item:");
      scanf("%f",&price);
      a=price*100;
      rs=a/100;
      paise=a%100;
      printf("Rupees:%f",rs);
      printf("Paise:%f",paise+1);
      }

      Delete
  3. 0tescuem_hi-1981 Jordan Shamoon Awesome
    Software
    nalematme

    ReplyDelete

Post a Comment

Popular Posts