C++ Program For Calculate Percentage Of 5 Subjects on Command Line Full Project For Beginners

  • Post author:
  • Post category:c++
  • Post comments:0 Comments

 

 

main.cpp

 

 

#include<iostream>
using namespace std;
int main()
{
    /* Program By Ghanendra Yadav
    Visit http://www.programmingwithbasics.com/
    */
   int sub,marks,n,i,sum=0,tmp=0,arr[10],Percentage;

   cout<<"\nEnter number of subject : \n";
   cin>>n;
   
   tmp=n*100;
   
   cout<<"\nEnter The Marks: \n";
   for(i=0;i<n;i++)
   {
    cin>>arr[i];
   }
   for(i=0;i<n;i++)
   {
    sum=sum+arr[i];
   } 
   
   Percentage = ( sum * 100 ) / tmp;
   
   cout<<"\nPercentage Of Student : \n"<< Percentage<<endl;

   return (0);
}

Leave a Reply