Pages

Monday, 5 March 2018

Write a program to display the following output using a single cout statement in C++ Programming Language. Subject Marks Mathematics 90 Computer 77 Chemistry 69


Write a program to display the following output using a single cout statement. 
   Subject            Marks
   Mathematics     90
   Computer         77
   Chemistry        69
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
    int sub1,sub2,sub3;
    cout<<"Enter Mathematics marks = ";
    cin>>sub1;
    cout<<"Enter Computer marks = ";
    cin>>sub2;
    cout<<"Enter Chemistry marks = ";
    cin>>sub3;
    cout<<"\nSubject\t\t\tMarks\n";
    cout<<"\nMathematics\t\t"<<sub1;
    cout<<"\nComputer\t\t"<<sub2;
    cout<<"\nChemistry\t\t"<<sub3;
    getch();
}