Getting Percentage in C++ Program:

Description:

In this post you can learn how you can get percentage of obtained marks easily by making a simple C++ program at Turbo C++ software. Turbo c++ make it easy for you to learn programming with in no time. Here you can learn how you can get percentage or modulus of obtained marks easily by putting the codded program given you below.

Program Structure:

#include<iostream.h>
#include<conio.h>
void main()
{
float a,b,percent;
cout<<"This is my fourth program"<<endl;
cout<<"Percentage of obtained marks"<<endl;
cout<<"Obtained marks: ";
cin>>a;
cout<<"/nTotal Numbers: ";
cin>>b;
percent=a/b*100;
cout<<"/nPercent= "<<percent;
getch();
}

Program Explanation:

The whole program can be explained easily below in points.
  1. Void main() is the predefined function.
  2. Cout<< the command to show the desired text or result on screen.
  3. Float represents the number or answers with decimal involved in it..
  4. /n command to make the program to go to next line.
  5. #Include<iostream> directives to show results.
  6. Cin>> to add data by the user function.
  7. { } opening and closing boundary of the program body. 
  8. A is Obtained marks and b is total marks as a whole.

Post a Comment

 
Top