Write a C C++ program to find simple interest

 

Flowchart

Flowchart to find Simple interest

 

Coding in C

#include<stdio.h>
int main()
{
int p;
float r,t,si;
printf(“Enter principle: “);
scanf(“%d”,&p);
printf(“Enter rate: “);
scanf(“%f”,&r);
printf(“Enter time: “);
scanf(“%f”,&t);
si=p*r*t/100;
printf(“Simple interest = %f”,si);
return 0;
}

 

Coding in C++

#include<iostream>
using namespace std;
int main()
{
int p;
float r,t,si;
cout<<“Enter principle: “;
cin>>p;
cout<<“Enter rate: “;
cin>>r;
cout<<“Enter time: “;
cin>>t;
si=p*r*t/100;
cout<<“Simple interest = “<<si;
return 0;
}

 

Output

Simple interest program output

 

Published by

admin

I am a computer teacher, programmer and web developer