Sunday, 16 October 2016

HHW Q25. WAP to calculate discount on entering sale amount .

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b;
cout<<"Enter the Sale Amount ";
cin>>a;
b=a>25000?25:(a>20000?20:(a>15000?15:(a>10000?10:(a>5000?5:0))));
cout<<"Discount = "<<b<<"%";
getch();
}

No comments:

Post a Comment

Basic Implementation of Array as a Pointer

#include<iostream.h> #include<conio.h> void main() { clrscr();   int arr[5];   cout<<"Enter 5 nos. ";   f...