Write a program to input the name, department, roll number and marks of 5 students using structure and print the details of those students who have scored above 750

Source Code

#include<stdio.h>
#include<conio.h>
int main (int argc, char *argv[])
{
  clrscr();
  struct student
  {
    char name[100];
    char dept[100];
    int rollno;
    float marks;
  };
  struct student s1,s2,s3,s4,s5;
  printf("\nEnter the name, dept, roll number and marks of five students:\n");
  scanf("%s %s %d %f",&s1.name,&s1.dept,&s1.rollno,&s1.marks);
  scanf("%s %s %d %f",&s2.name,&s2.dept,&s2.rollno,&s2.marks);
  scanf("%s %s %d %f",&s3.name,&s3.dept,&s3.rollno,&s3.marks);
  scanf("%s %s %d %f",&s4.name,&s4.dept,&s4.rollno,&s4.marks);
  scanf("%s %s %d %f",&s5.name,&s5.dept,&s5.rollno,&s5.marks);
  printf("\nThe name, dept, roll number and marks of students are:");
  if(s1.marks>750)
    printf("\n%s %s %d %f",s1.name,s1.dept,s1.rollno,s1.marks);
  if(s2.marks>750)
    printf("\n%s %s %d %f",s2.name,s2.dept,s2.rollno,s2.marks);
  if(s3.marks>750)
    printf("\n%s %s %d %f",s3.name,s3.dept,s3.rollno,s3.marks);
  if(s4.marks>750)
    printf("\n%s %s %d %f",s4.name,s4.dept,s4.rollno,s4.marks);
  if(s5.marks>750)
    printf("\n%s %s %d %f",s5.name,s5.dept,s5.rollno,s5.marks);
  getch();
}

Find More from our code collection
Armstrong number, binary number to a decimal number, bubble sort, decimal number to binary number, factorial of the given number factors, fibonacci numbers, HCF and LCM, matrix, mergesort, salary of the employee. palindrome, quadratic equation, star patterns, series etc. and much more...
#Return to Example Source Code