Write a program to display the following output using a single cout statement.
Subject Marks
Mathematics 90
Computer 77
Chemistry 69
|
Source Code:
#include<iostream> using namespace std; int main() { cout<<"subject " <<"\tmarks"<<"\nmathematic\t" <<90<<"\ncomputer\t"<<77<<"\nchemistry\t"<<69; return 0; }
Output :
Subject Marks
Mathematics 90
Computer 77
Chemistry 69
For adding space \t is used and for new line \n is used. Please not that these are used inside double quotes ""
No comments:
Post a Comment