Saturday, July 1, 2017

C++ program to read roll number and marks

This C++ program shows how to declare and use int variables. Program will read roll number and marks from user and display it on screen.

#include<iostream>
using namespace std;
int main()
{
 int marks, rollno;

 cout << "Enter your Roll No:";
 cin >> rollno;

 cout << "Enter your Marks:";
 cin >> marks;

 cout << "\nYour Roll No. is " << rollno << "\n";
 cout << "Your marks are " << marks;
 return 0;
}

Output of program

Enter your Roll No:101
Enter your Marks:90

Your Roll No. is 101
Your marks are 90


No comments:

Post a Comment