+ 5
Hey can anybody help me in..
in array (c language) hw to write program for simple interest [10] ???
3 odpowiedzi
+ 4
#include<stdio.h>
int main()
{
int amount, rate, time, si;
printf("\nEnter Principal Amount : ");
scanf("%d", &amount);
printf("\nEnter Rate of Interest : ");
scanf("%d", &rate);
printf("\nEnter Period of Time : ");
scanf("%d", &time);
si = (amount * rate * time) / 100;
printf("\nSimple Interest : %d", si);
return(0);
}
+ 1
#include <stdio.h>
void main()
{
int n, p, r;
printf("Enter the number of years\n");
scanf("%d",&n);
printf("Enter the principal amount \n");
scanf("%d",&p);
printf("Enter the rate of interest\n");
scanf("%d",&r);
//Formula for simple interest.
//reusing the variable p as simple interest.
p = (n*p*r)/100;
printf("\nSimple interest is = (%d)",p);
}
+ 1
by using array , you want to reduced the space complexcity . good