in c++ 1. Write a code which accept marks of three subjects as argument and return CGPA on the basis of marks.
#include <iostream>
using namespace std;
int getCGPA(int m1,int m2,int m3){
int sum=m1+m2+m3;
int cgpa=sum/3;
return cgpa;
}
int main()
{
int a,b,c;
cout<<"Enter the marks of the three subjects:\n";
cin>>a>>b>>c;
cout<<"CGPA is: "<<getCGPA(a,b,c);
return 0;
}
Comments
Leave a comment