Write a program using structure in C that reads records of 10 students with roll number, name, address and displays the records of student who obtained greater than 250

#include <stdio.h>
struct Student 
    int roll_number;
    char name[50];
    char address[100];
    int marks;

int main() 
    struct Student students[10];
    int i;

    // Read the records of 10 students
    for (i = 0; i < 10; i++) {
        printf("Enter details of student %d:\n", i+1);
        printf("Roll Number: ");
        scanf("%d", &students[i].roll_number);
        printf("Name: ");
        scanf("%s", students[i].name);
        printf("Address: ");
        scanf("%s", students[i].address);
        printf("Marks: ");
        scanf("%d", &students[i].marks);

    // Display the records of students who obtained greater than 250
    printf("\nStudents who obtained greater than 250:\n");
    for (i = 0; i < 10; i++) 
        if (students[i].marks > 250) 
            printf("Roll Number: %d\n", students[i].roll_number);
            printf("Name: %s\n", students[i].name);
            printf("Address: %s\n", students[i].address);
            printf("Marks: %d\n", students[i].marks);

    return 0;


User inputs information of 10 students:

What user Gets result who secured more than 250 marks

Leave a Reply

Your email address will not be published. Required fields are marked *