Write a C C++ program to find simple interest

Write a C C++ program to find simple interest

Object Oriented Programming (OOP) की विभिन्न अवधारणाओं को जानने के लिए देखें—Concepts of OOP

C Language की विशेषताओं एवं शक्तियों को जानने के लिए देखें—Features and Powers of C

Flowchart to find simple interest

Flowchart to find Simple interest

C program to find simple interest

#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;
}

C++ program to find simple interest

#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 of C C++ program to find simple interest

Enter principle: 1000
Enter rate: 5
Enter time: 2
Simple interest = 100.000000
Enter principle: 60544
Enter rate: 3.2
Enter time: 2.5
Simple interest = 4843.520000

Some other C and C++ important programs

  1. Sum of two entered numbers
  2. Average of three entered numbers
  3. Total and Percent
  4. Swapping values of two variables
  5. Swapping without using third variable
  6. Celsius to Fahrenheit conversion
  7. Find area and circumference of circle
Share it to:

Published by

admin

I am a computer teacher, programmer and web developer