First Method:
#include <stdio.h>
int main() {
float n;
printf("Enter the purchase amount:");
scanf("%f",&n);
if(n>=2000)
{
printf("Net Pay=%.2f",n-(n*0.20));
}
else
{
printf("Net Pay=%.2f",n-(n*0.05));
}
}
Second Method:
#include <stdio.h>
int main() {
float n;
printf("Enter the purchase amount:");
scanf("%f",&n);
if(n>=2000)
{
printf("Net Pay=%.2f",n*0.80);
}
else
{
printf("Net Pay=%.2f",n*0.95);
}
}
No comments:
Post a Comment