Use C Program and Develop a compound interest program to rep

Use C Program and Develop a compound interest program to repeat its stops for interest rates of 5 percent 6 percent, 7 percent, 8 percent, 9 percent, and 10 percent. Use a for loop to vary the interest rate. Write a program that prints the following patterns separately one below the other. Use for loops to generate the patterns. All asterisks (*) should be printed by a single printf statement of the form printf (\"*\"); this causes the asterisks to print side by side).

Solution

Compound Interest program

#include<stdio.h>
#include <math.h>
void main()
{
   int p, y;
   float power, ci, r;
   printf(\"Enter Principal amount\ \");
   scanf(\"%d\",&p);
   printf(\"Enter years\ \");
   scanf(\"%d\",&y);
   for(r=5;r<=10;r++)
   {
       power =pow((1+(r/100)),y);
       ci = p*(power-1);
       printf(\"\ The compound Interest at rate %f is %f\ \",r,ci);
   }
}

Pattern program

#include<stdio.h>
void main()
{
   int i,j,k;
   for(i=0;i<10;i++)
   {
       for(j=0;j<=i;j++)
           printf(\"*\");
       printf(\"\ \");  
   }
   for(i=0;i<10;i++)
   {
       for(k=9;k>i;k--)
           printf(\" \");
       for(j=0;j<=i;j++)
           printf(\"*\");
       printf(\"\ \");  
   }
}

 Use C Program and Develop a compound interest program to repeat its stops for interest rates of 5 percent 6 percent, 7 percent, 8 percent, 9 percent, and 10 pe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site