Wednesday, 23 November 2016

Write a program that uses two arrays to store the roll number and marks of students.....

Write a program that uses two arrays to store the roll number and marks of students.It inputs roll numbers and marks of five students and stores them in corresponding elements of the arrays. The program finally displays the roll number and marks of the students with highest marks.



        #include <iostream.h>
        #include <conio.h>
        int main ()
       {
             int rno[5], marks[5];
             int i;

             cout<< "Enter roll number and marks of the student: " ;
             for(i = 0;i<5;i++)
                cin>>rno[i] >>marks[i];

             max = 0;
             for(i = 1;i <5;i++)
                if(marks[i]>marks[max])
                    max = i;

             cout<< "The student with highest marks: " <<endl;
             cout<< " Roll Number: " <<rno[max]<<endl;
             cout<< " Marks: " <<marks[max];
             return 0;
       }    
               

2 comments:

  1. this code is not running? how is this correct?

    ReplyDelete
  2. the code is running just take int data type before the max variable dear

    ReplyDelete

If you have any doubt please let me know

Methods in JAVA Language

 In general, a way may be thanks to perform some task. Similarly, the tactic in Java may be a collection of instructions that performs a sel...