Learn Programming Technique C to Master Skills - Explanation of Second Program

  • last week
Transcript
00:00Hi, I'm Sandeep.
00:05Today I'm going to make the program of simple interest in which I'm going to input the values
00:09from the keyboard.
00:11I'm going to input the values of principal rate of interest and time.
00:16I have explained this program in flowchart in my last video.
00:19Okay, this is the flowchart of it in which I have input the principal rate of interest
00:25and time.
00:26Calculation work took place and the resulted value stored inside has been displayed.
00:32Now I'm going to make the same program.
00:34I'm going to implement the same program in C.
00:37So I'll make this program in the code blocks.
00:41Let us see.
00:42First of all, I will go to file, then new, then empty file.
00:49I will save it also.
00:50So file, then I will come towards save file, I will give it a name what prgn2, something
00:58like this, then what save.
01:01Use what hash include stdio.h, then I will use what int main and inside it, I will take
01:14the variables that is int s, p, r, t.
01:22Next step will be what to display a message that what I'm going to input that is input
01:30principal rate of interest and time.
01:42So input the values from the next line, so I will use here slash n at the end of the
01:48statement also, at the end of the message.
01:52I will use what is scanf and inside it, %d, %d, %d.
02:00So I've used the type specifier for three times as I have to input three values, one
02:09inside p, another one inside r.
02:13So with and sign, I will use what and p, and r, and what, and t.
02:27Now at the end, I will use what semicolon, then I will give a formula s equal to p into
02:35r into t upon 100.
02:40I have calculated the simple interest, I have to display it, so printf slash n simple interest
02:53is %d, at the end what comma s, and then what return 0.
03:05I will save the program by use of control s, I've saved it.
03:17So now the program is ready, I will click on this build button and see if there's any
03:25error or not, so it's showing zero error, zero warning, and then I'm going to click
03:30on run.
03:31It will ask me to input the principal, suppose I input 2000, and rate of interest 3, and
03:38time t, when I press enter, it's going to calculate and display the simple interest.
03:43If I again run this program, I can give different values like principal 5000, rate of interest
03:534, time what 2, and when I press it, it's going to give me another result, a different
03:59result, and it's calculated the simple interest.
04:03So I hope you understand the program, in the next video I'm going to explain something
04:10else.
04:11Thanks.

Recommended