Program to Convert Rupess into Paisa using c language

11/15/2023

#Rupees to Paisa conversion, #beginner-friendly C programs #c_lang

Go Back

C Program to Convert Rupees into Paisa

If you're learning the basics of C programming, a simple and practical exercise is to write a program that converts Rupees into Paisa. This program demonstrates how to use basic input, processing, and output functionalities in C. Here's a step-by-step guide and code example to achieve this.

#Rupees to Paisa conversion, #beginner-friendly C programs #c_lang

Why Learn This Program?

Understanding how to handle numeric data and perform simple arithmetic operations is fundamental in programming. This program teaches you:

  • How to take user input in C.
  • How to perform basic arithmetic operations.
  • How to display the output to the user.

Complete C Program to Convert Rupees into Paisa

Below is the complete code:

#include<stdio.h>
#include<conio.h>

int main()
{
    float rs;  // Define variable for rupees
    int ps;    // Define variable for paisa
    clrscr();

    printf("\n\n Kindly enter the value in Rupees to convert into Paisa: ");
    scanf("%f", &rs);

    ps = rs * 100;  // Conversion logic

    printf("\n The value in Paisa is: %d", ps);

    getch();
    return 0;
}

Explanation of the Code

  1. Variable Declaration:

    • float rs: Used to store the amount in Rupees.
    • int ps: Used to store the amount in Paisa after conversion.
  2. Input Statement:

    • The scanf function is used to take the user input for the value of Rupees.
  3. Conversion Logic:

    • The value in Rupees is multiplied by 100 to convert it into Paisa.
  4. Output Statement:

    • The printf function displays the result in Paisa.
  5. Program Flow:

    • The program waits for the user to input a value in Rupees.
    • It performs the conversion and displays the result.

Sample Output

Input:

Kindly enter the value in Rupees to convert into Paisa: 12.50

Output:

The value in Paisa is: 1250

Conclusion

This simple C program demonstrates how to convert an amount from Rupees to Paisa by multiplying the input value by 100. It's an excellent exercise for beginners to understand basic arithmetic operations, variable handling, and user interaction in C.

By practicing such programs, you can build a strong foundation in programming and gradually move on to more complex projects.