Program to print simple intrest | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Program to print simple intrest

Please ans

24th Dec 2021, 6:42 PM
sonam saini
8 Answers
+ 1
Whats your idea for the program? Ok, so lets step it out in pseudo code then build it. What C do you know so far?
24th Dec 2021, 6:56 PM
William Owens
William Owens - avatar
+ 1
Actually i am a beginner
24th Dec 2021, 6:57 PM
sonam saini
0
Want to know
24th Dec 2021, 6:57 PM
sonam saini
0
Lets start with what is the definition of simple interest. We will go with Simple Interest (SI) = (Principle * Interest * Time) / 100 Far enough?
24th Dec 2021, 7:03 PM
William Owens
William Owens - avatar
0
Just going with that we could set three variables but we need to know what types Principle and Interest are money so they have a decimal we can use float float principle = 45000.50; //$45,000.50 float interest = 3.5; //This is 3.5% next is time since we are talking simple interest we will look at number of years so we will use an integer int time = 3 //3 years now we can use some simple math but we have to set a variable to return it for us we know it will be money again so we will use a float. float simpleInterest = (principle * interest * time) / 100; the variable simpleInterest would now hold the value of the Simple Interest We could use a print function to display it or return it to some other function. printf("The simple interest of $45,000.50 at 3.5% for 3 years is: %.2f\n", simpleInterest); How would you put all that together?
24th Dec 2021, 7:18 PM
William Owens
William Owens - avatar
0
Oh thank you so much william❤️
24th Dec 2021, 7:19 PM
sonam saini
0
#include<studio.h> Void main() { Float interest, principle; Int time; Printf("simple interest is %d", (principle*time*interest)/100); }
26th Dec 2021, 5:54 AM
Vinuthna Reddy
0
Vinuthna Reddy Good attempt a few issues, C is case sensitive your functions won't work, main has to return something can't be void. The argents list can be void though.
26th Dec 2021, 1:31 PM
William Owens
William Owens - avatar