Wednesday, April 12, 2017

C Program to find the simple interest

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

C program to calculate power of number.

#include<stdio.h>
#include<conio.h>
int main()
{
 int num,pow,res=1;
 printf("\nEnter number and power : ");
 scanf("%d %d",&num,&pow);
 while(pow>=1)
 {
  res=res*num;
  pow--;
 }
 printf("%d",res);
 return 0;
}