saving . . . saved Relational Operators assignment has been deleted. Relational Operators assignment has been hidden .
Relational Operators assignment
Title
Question
Write a program that takes the marks of three students as input.
Compare the marks to see which student has scored the highest.
Check also if two or more students have scored equal marks.

C-and-Cpp Relational-Operators 08-09 min 30-40 sec 03-06-22, 5:10 p.m. adarashkumar9002@gmail.com

Answers:

A meaningful program can be written as follows:
#include <stdio.h>
int main()
{
    int m1,m2,m3;
    printf("Enter the marks of student 1\n");
    scanf("%d %d %d",&m1,&m2,&m3);
    if(m1 > m2 & m1 > m3)
    printf("student 1 got the highest marks of %d \n",m1);
    else if (m2 > m1 & m2 > m3)
    printf("student 2 got the highest marks of %d \n",m2);
    else if (m3 > m1 & m3 > m2)
    printf("student 3 got the highest marks of %d \n",m3);
    if(m1 == m2 & m1== m3)
    printf("same marks has been received by the students\n");
    else if (m1==m2)
     printf("same marks has been received by the students 1 and 2\n");
    else if (m1==m3)
     printf("same marks has been received by the students 1 and 3\n");
    else if (m2==m3)
     printf("same marks has been received by the students 2 and 3\n");
    return 0;
}
06-06-22, 12:58 p.m. hbammkanti


Log-in to answer to this question.