We would like to assess a service charge for cashing a check. The service charge
ID: 3763573 • Letter: W
Question
We would like to assess a service charge for cashing a check. The service charge depends on the amount of the check. If the check amount is less than $10, we will charge $1. If the amount is greater than $10 but less than $100, we will charge 10 percent of the amount. If the amount is greater than $100, but less than $1,000, we will charge $5 plus 5 percent of the amount. If the value is over $1,000, we will charge $40 plus 1 percent of the amount. Use a multibranch if-else statement in a fragment of code to compute the service charge.
Explanation / Answer
#include<stdio.h>
#include<conio.h>
main()
{
floatt amt,n,m;
printf("enter amount");
scanf("%f",&amt);
if(amt<=10)
{
printf("will be charge 1 %");
scanf("%f",&amt);
m=amt+1;
printf("%f",m);
}
else if(amt>100&&amt<10)
{
printf("will be charge 10%");
n=((amt*10))/100);
m=n+amt;
printf("%f",m);
}
else if(amt>100&&amt<1000)
{
printf("will be charge 40%");
n=((amt*40)/100);
m=n+amt;
printf("%f",m);
}
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.