0% found this document useful (0 votes)
6 views1 page

Dollar

The code defines an exchange rate variable and declares two float variables. It prompts the user to enter a dollar amount, converts it to Pakistani rupees by multiplying by the exchange rate, and prints the results.

Uploaded by

Sobia Zeeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Dollar

The code defines an exchange rate variable and declares two float variables. It prompts the user to enter a dollar amount, converts it to Pakistani rupees by multiplying by the exchange rate, and prints the results.

Uploaded by

Sobia Zeeshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

h>

int main() {

// Define the exchange rate (1 USD = 300 PKR)

float exchangeRate = 300.0;

// Declare variables

float dollarAmount, pkrAmount;

// Prompt user to enter dollar amount

printf("Enter the amount in dollars: ");

scanf("%f", &dollarAmount);

// Convert dollar amount to Pakistani Rupees

pkrAmount = dollarAmount * exchangeRate;

// Display the converted amount in Pakistani Rupees

printf("%.2f USD is equivalent to %.2f PKR\n", dollarAmount, pkrAmount);

return 0;

You might also like