Assignment 1:
//Program 1 to calculate simple interest given p,r,t:
#include<stdio.h>
int main()
{
int p= 100;
int r= 4;
int t= 12;
float simple_interest=(p*r*t)/100; //since we are dividing by 100 we might get decimal value.
printf("%f",simple_interest);
return 0;
}
logic map:(how to think)
assume three value principle ,rate , year
name each of them as different variables
write the mathematical formula and assign it to a variable
print the variable
Program 2:
#include<stdio.h>
int main()
{
int length=4;
int breadth=15;
int area;
area=length*breadth;
printf("%d",area);
}
No comments:
Post a Comment