RUPEE NAME

Description:

Write a program that reads the cost of an item in the form RRRR.PP (where RRRR denotes rupees and PP denotes paise) Refer sample input and output. Test Case 1 Input (stdin) 104.3 Expected Output ONE HUNDRED FOUR AND PAISE THIRTY Test Case 2 Input (stdin) 4.5 Expected Output FOUR AND PAISE FIFTY

Program :

#include <stdio.h>

int main()

{

  float Cost,Pai,Re;

  int Rup,i,R;

  scanf("%f",&Cost);

  Rup=Cost;

  Pai=(Cost-Rup)*100;

  i=Rup/100;

  switch(i)

  {

    case 1:printf("ONE HUNDRED ");break;

    case 2:printf("TWO HUNDRED ");break;

    case 3:printf("THREE HUNDRED ");break;

    case 4:printf("FOUR HUNDRED ");break;

    case 5:printf("FIVE HUNDRED ");break;

    case 6:printf("SIX HUNDRED ");break;

    case 7:printf("SEVEN HUNDRED ");break;

    case 8:printf("EIGHT HUNDRED ");break;

    case 9:printf("NINE HUNDRED ");break;

  }

  i=Rup%100;

  R=i/10;

  Re=(float)i/10;

  switch(R)

  {

    case 1:printf("TEN");break;

    case 2:printf("TWENTY ");break;

    case 3:printf("THIRTY ");break;

    case 4:printf("FOURTY ");break;

    case 5:printf("FIFTY ");break;

    case 6:printf("SIXTY ");break;

    case 7:printf("SEVENTY ");break;

    case 8:printf("EIGHTY ");break;

    case 9:printf("NINETY ");break;

  }

  R=(Re-R)*10;

  switch(R)

  {

    case 1:printf("ONE");break;

    case 2:printf("TWO ");break;

    case 3:printf("THREE ");break;

    case 4:printf("FOUR ");break;

    case 5:printf("FIVE ");break;

    case 6:printf("SIX ");break;

    case 7:printf("SEVEN ");break;

    case 8:printf("EIGHT ");break;

    case 9:printf("NINE ");break;

  }

  printf("AND PAISE ");

  i=Pai/10;

  Re=(float)Pai/10;

  R=(Re-i)*10;

  switch(i)

  {

    case 1:printf("TEN");break;

    case 2:printf("TWENTY ");break;

    case 3:printf("THIRTY ");break;

    case 4:printf("FOURTY ");break;

    case 5:printf("FIFTY ");break;

    case 6:printf("SIXTY ");break;

    case 7:printf("SEVENTY ");break;

    case 8:printf("EIGHTY ");break;

    case 9:printf("NINETY ");break;

  }

  switch(R)

  {

    case 1:printf("ONE");break;

    case 2:printf("TWO ");break;

    case 3:printf("THREE ");break;

    case 4:printf("FOUR ");break;

    case 5:printf("FIVE ");break;

    case 6:printf("SIX ");break;

    case 7:printf("SEVEN ");break;

    case 8:printf("EIGHT");break;

    case 9:printf("NINE");break;

  }

  return 0;

}