Monday, March 28, 2011
Exercise 1
#include < iostream.h >
main()
{
//declaire variable
float cgpa, total, total2;
cout<<"Muhammad FIrdaus Bin Hasmi" << endl;
cout<<"05-201006-00003" << endl;
//input
cout<<"\nPlease enter your CGPA = ";
cin>>cgpa;
if (cgpa == 4.00)
{total = (100/100)*16000;
total2 = 16000 - total;}
else if (3.00<=cgpa<=3.99)
{total = (80/100)*16000;
total2 = 16000 - total;}
else if (2.00<=cgpa<=2.99)
{total = (40/100)*16000;
total2 = 16000 - total;}
else if (0<=cgpa<=1.99)
{total = (100/100)*16000;
total2 = 16000 - total;}
else {cout << "Invalid CGPA";}
//output
cout<<"Your CGPA is " << cgpa << endl;
cout<<"Your Discount " << total << endl;
cout<<"You have to pay " << total2 << endl;
return 0;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment