Program to Convert Rupess into Paisa using c language
#Rupees to Paisa conversion, #beginner-friendly C programs #c_lang
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.
Understanding how to handle numeric data and perform simple arithmetic operations is fundamental in programming. This program teaches you:
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;
}
Variable Declaration:
float rs
: Used to store the amount in Rupees.int ps
: Used to store the amount in Paisa after conversion.Input Statement:
scanf
function is used to take the user input for the value of Rupees.Conversion Logic:
Output Statement:
printf
function displays the result in Paisa.Program Flow:
Kindly enter the value in Rupees to convert into Paisa: 12.50
The value in Paisa is: 1250
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.