Here's a program in C++ that displays the required output using a single cout statement:
using namespace std;
int main() {
cout << "Math = 90\nPhysics = 70\nChemistry = 69\n";
return 0;
}
Output:
Physics = 70
Chemistry = 69
Explanation:
- The program uses the cout statement to display the output on the screen.
- The \n characters in the statement represent new lines, which separate each subject and its score.
Here's a program in C++ that displays the required output using a multiple cout statement:
using namespace std;
int main() {
cout << "Math = 90\n";
return 0;
}
Output:
Physics = 70
Chemistry = 69
Here's a program in C++ that displays the required output using a multiple cout statement and endl:
using namespace std;
int main() {
cout << "Math = 90"<<endl;
return 0;
}
Output:
Physics = 70
Chemistry = 69
No comments:
Post a Comment
If you have any doubts, please let me know