#include <iostream>
using namespace std;
int main () {
// we declare a variable for computer science marks
int computer_science_marks;
cout << "Enter your marks in Computer Science: ";
cin >> computer_science_marks;
// we declare a variable for obtained marks
char obtained_marks[10];
cout << "Enter your obtained marks: ";
cin >> obtained_marks;
string number = " ";
// this is cycle for seperate number in a obtained marks
for (int i = 0; i < 10; i++) {
if (isdigit(obtained_marks[i])) {
number += obtained_marks[i];
}
}
int obtained_marks_integer;
obtained_marks_integer = stoi(number);
cout << "the ratio is computer science marks to obtained marks is " << (float) computer_science_marks / obtained_marks_integer;
return 0;
}
Comments
Leave a comment