Assignment
Title
Question
Assignment program for calculating simple interest
#include <stdio.h>
int main()
{
float principle, time, rate, SI;
printf("Enter principle amount: ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
/* Calculate simple interest */
SI = (principle * time * rate) / 100;
printf("Simple Interest = %f", SI);
return 0;
}
Haripriya,ECE department
IRTT
C-and-Cpp Tokens 01-02 min 10-20 sec
Answers:
Assignments are only for self-assessment. If you have any specific question related to this tutorial please post here.
#Include<stdio.h>
#include<conio.h>
void main()
{
float p,t,r;
double si;
printf("enter the p value:");
scanf("%f",&p);
printf("enter the t value:");
scanf("%f",&t);
printf("enter the r value");
scanf("%f",&r);
si=(p*t*r)/100;
printf("si=%lf,si);
getch();
}
#include<stdio.h>
#include<conio.h>
int main()
{
float principle, time, rate, SI;
printf("enter principle amount:");
scanf("%d", &principle);
printf("enter time:");
scanf("%d", &time);
printf("enter rate:");
scanf("%d", &rate);
SI=(principle* time* rate)/100;
printf("simple interest=%d", SI);
return 0;
}
Assignment program to find the sum and average of any three given numbers.
int main()
{
int a,b,c;
float sum,avg;
printf("Enter the a value:");
scanf("%d",&a);
printf("Enter the b value:");
scanf(%d",&b);
printf("Enter the c value:");
scanf("%d",^&c);
sum=a+b+c;
avg=(a+b+c)/3;
printf("Sum of given numbers is %d",sum);
printf("Average of given numbers is %d",avg);
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
float principle, time, rate, SI;
printf("enter principle amount:");
scanf("%d", &principle);
printf("enter time:");
scanf("%d", &time);
printf("enter rate:");
scanf("%d", &rate);
SI=(principle* time* rate)/100;
printf("simple interest=%d", SI);
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
float principle, time, rate, SI;
printf("enter principle amount:");
scanf("%d", &principle);
printf("enter time:");
scanf("%d", &time);
printf("enter rate:");
scanf("%d", &rate);
SI=(principle* time* rate)/100;
printf("simple interest=%d", SI);
return 0;
}
#include <stdio.h>
int main()
{
float principle, time, rate, SI;
printf("Enter principle amount: ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
/* Calculate simple interest */
SI = (principle * time * rate) / 100;
printf("Simple Interest = %f", SI);
return 0;
}
#include<stdio.h>
#include<conio.h>
int main()
{
float principle, time, rate, SI;
printf("enter principle amount:");
scanf("%d", &principle);
printf("enter time:");
scanf("%d", &time);
printf("enter rate:");
scanf("%d", &rate);
SI=(principle* time* rate)/100;
printf("simple interest=%d", SI);
return 0;
}
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
output
enter principle(amount):500
enter time:2
enter rate:5
Simple Interest=50.00
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
output
enter principle(amount):500
enter time:2
enter rate:5
Simple Interest=50.00
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
output:
enter principle(amount):500
enter time:2
enter rate:5
Simple Interest=50.00
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
#include<stdio.h>
int main()
{
float principle,rate,time,SI;
printf("enter principle(amount):");
scanf("%f",&principle);
printf("enter time:");
scanf("%f",&time);
printf("enter rate:");
scanf("%f",&rate);
SI=(principle*time*rate)/100;
printf("Simple Interest=%.2f",SI);
return 0;
}
Login to add comment