Use only scanner class for input) 1. Write a program to calculate the simple interest by accepting the Principal amount ,rate per annum and time.(SI = pnr/100) 2. Write a program to accept the profit and cost price of a product and find the profit percentage.
Answers
Answer:
nope can't understand
Explanation:
please say properly
Answer:
Explanation:
1 #include <stdio.h>
int main()
{
float principle, time, rate, SI;
/* Input principle, rate and time */
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
/* Calculate simple interest */
SI = (principle * time * rate) / 100;
/* Print the resultant value of SI */
printf("Simple Interest = %f", SI);
return 0;
}
2
// C++ implementation of above approach
#include <iostream>
using namespace std;
// Function to calculate the Selling Price
float SellingPrice(float CP, float PP)
{
// Decimal Equivalent of Profit Percentage
float P_decimal = 1 + (PP / 100);
// Find the Selling Price
float res = P_decimal * CP;
// return the calculated Selling Price
return res;
}
// Driver code
int main()
{
// Get the CP and Profit%
float C = 720, P = 13;
// Printing the returned value
cout << SellingPrice(C, P);
return 0;
}