Write down the simple interest program using for loop in c

Here a C program to calculate simple interest using for loop.

main ( )
{
int p, n, count ;
float r, si ;
for ( count = 1 ; count <= 3 ; count = count + 1 )
{
printf ( “Enter values of p, n, and r ” ) ;
scanf ( “%d %d %f”, &p, &n, &r ) ;
si = p * n * r / 100 ;
printf ( “Simple Interest = Rs.%f\n”, si ) ;
}
}

Flow is here to understand more:

 

for loop flowchart
for loop flowchart

 

Related Posts

  • 58
    It is often the case in programming that you want to do something a fixed number of times. Perhaps you want to calculate gross salaries of ten different persons, or you want to convert temperatures from centigrade to Fahrenheit for 15 different cities. Let us look at a example which…
    Tags: count, si, loop, printf, interest, simple, main, float, scanf, values
  • 56
    we would write our first C program now. Once we have done that we would see in detail the instructions that it made use of. Before we begin with our first C program do remember the following rules that are applicable to all C programs: Each instruction in a C…
    Tags: program, si, printf, example, interest, main, simple, calculate, values
  • 49
    Problem Statement: Write a program to calculate the salary as per the following table: Solution: /* C program to calculate salary */ main( ) { char g ; int yos, qual, sal ; printf ( "Enter Gender, Years of Service and Qualifications ( 0 = G, 1 = PG ):" )…
    Tags: program, calculate, example, write
  • 45
    Write a C Program for the following :- Ramesh’s basic salary is input through the keyboard. His dearness allowance is 40% of basic salary, and house rent allowance is 20% of basic salary. Write a program to calculate his gross salary. Answer:  /* To Calculate the gross salary of Ramesh…
    Tags: printf, program, write, calculate, float, enter, main, example
  • 42
    Problem Statement: The distance between two cities (in km.) is input through the keyboard. Write a C program to convert and print this distance in meters, feet, inches and centimeters. Answer: /* Conversion of distance */ #include <stdio.h> #include <conio.h> main() { float km, m, cm, ft, inch; clrscr(); /*…
    Tags: printf, program, write, calculate

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: