Differentiate Rupees and Paisa from total Rupees
#include <stdio.h>
int main() { int totalRupees, rupees, paisa; // Input the total amount in rupees printf("Enter the total amount in rupees: "); scanf("%d", &totalRupees); if (totalRupees >= 0) { // Extract rupees and paisa rupees = totalRupees / 100; paisa = totalRupees % 100; // Display rupees and paisa printf("Rupees: %d\n", rupees); printf("Paisa: %d\n", paisa); } else { printf("Invalid amount. Please enter a non-negative value.\n"); } return 0; }
Comments
Post a Comment