Thursday, March 7, 2013

Ask the user for his/her marks in CP Midterm #1 (out of 60) and find out the percentage marks.

Program Sample Output

 e.g. 1
Sample Input: (Note: Bold refers to user input)
Enter your marks in “CP Midterm #1” : 25

Sample Output:
Your marks as a percentage are: 40.00 %

e.g. 2
Sample Input: (Note: Bold refers to user input)
Enter your marks in “CP Midterm #1”: 60

Sample Output:
Your marks as a percentage are: 100.00 %

  CODE
#include<iostream>
#include<conio.h>
#include<iomanip.h>

main()
{
       float marks;
       cout<<"Enter your marks in CP (Out of 60): ";
       cin>>marks;
       float result= (marks/60);
       cout<<"Your marks as a percentage are : "<<result*100;
       getche();
       return 0;    
}

Download this executable of this project from HERE

NOTE: You will need Dev C++ or TC compiler to compiler this code properly

No comments:

Post a Comment