Write a program in C++ to input roll no, name and marks and display entered details and average marks

#include <iostream.h>
#include <conio.h>

int main() {
    int rollno;
    char name[30];
    float mat, sci, com;
    
    cout << "Roll No: ";   
    cin >> rollno;
    
    cout << "Name: ";
    cin >> name;
    
    cout << "\nEnter Marks:" << endl;
    cout << "Maths: ";
    cin >> mat;
    
    cout << "Science: ";
    cin >> sci;
    
    cout << "Computer: ";
    cin >> com;
    
    cout << "\n------\n\n";
    
    cout << "Roll No: " << rollno << endl;
    cout << "Name: " << name << endl;
    cout << "Average: " << (mat+sci+com)/3;
    
    getch();
    return 0;
}


Output:



Leave a Reply

Contact Form

Name

Email *

Message *

Followers