63 036
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #41484 in Prolog for ahmed

Question #41484
write a prolog code that accepts input of CGPA from user and determine the level of that CGPA
Expert's answer
#include <iostream>
char determineGrade (double CGPA) {
if ( CGPA  <= 100 && CGPA >= 90 ) {
  return 'A';
}
if ( CGPA >=80 && CGPA <=89 ) {
  return 'B';
}
if ( CGPA >= 70 && CGPA <= 88 ) {
  return 'C';
}
if ( CGPA >=65 && CGPA <= 69 ) {
  return 'D';
}
if ( CGPA <= 64 ) {
  return 'F';
}
}
int main() {
double CGPA = 0;
std::cout << "Please input the CGPA in percentage." << std::endl;
std::cin >> CGPA;
while ( CGPA < 0 || CGPA > 100 ) {
  std::cout << "Acceptable values are from 0 till 100"  << std::endl;
  std::cin >> CGPA;
}
std::cout << "Your grade is " << determineGrade(CGPA) << std::endl;
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions