Question :- write a C program to calculate the discount using if statement.
URGENT PLEASE
Answers
Answered by
1
Answer:
#include<stdio.h>
main()
{
int qty,dis=0; /*initializing is required as if tot<1000, then discount is 0*/
float rate, tot;
printf ("Enter quantity and rate: ");
scanf ("%d %f", &qty, &rate);
if (qty>1000)
dis=10;
tot=(qty*rate) - (qty*rate*dis/100);
printf("Total expenses = Rs. %f", tot);
}
Answered by
0
Answer:
#include<stdio.h>
#include<conio.h>
void main()
{
int qty,dis=0; /*initializing is required as if tot<1000, then discount is 0*/
float rate, tot;
printf ("Enter quantity and rate: ");
scanf ("%d %f", &qty, &rate);
if (qty>1000)
dis=10;
tot=(qty*rate) - (qty*rate*dis/100);
printf("Total expenses = Rs. %f", tot);
}
Similar questions