Exercise Questions - Structures

  1. Input 10 students record in array and display them.
  2. #include<stdio.h>
    struct student
        int rollno;
        char name[20];
        int hindi, english, maths, science, sstudies;
        int total;
        float per;
    int main()
        int i;
            printf("enter student rollno, name and hindi, english, maths, science, sstudies");
            scanf("%d%s%d%d%d%d%d", &s[i].rollno, &s[i].name, &s[i].hindi, &s[i].english, &s[i].maths, &s[i].science, &s[i].sstudies);
            printf("student info:\n");
            printf("roll no.\nname:\nhindi marks:\nenglish marks:\nmaths marks:\nscience marks:\n;sstudies marks:\n", s[i].rollno, s[i].name, s[i].hindi, s[i].english, s[i].maths, s[i].science, s[i].sstudies);
        return 0;
  3. Create a structure to maintain 10 students record. Structure should contain name, 5 subject marks of each student, also create a switch case menu that contain the following options:
    a. Find Total and percentage.
    b. Find the record of student who score highest marks.
    c. Find the record of student who score less than 40 percentage.
    d. Display grade of all student corresponding to the percentage.
  4. Create a structure to specify data of customers in a bank. The data to be stored is: Account number, Name, Balance in account. Assume maximum of 20 customers in the bank.
    a. Write a function to print the Account number and name of each customer with balance below Rs. 1000.
    b. If a customer request for withdrawal or deposit, it is given in the form: Acct. no, amount, code (1 for deposit, 0 for withdrawal)
    Write a program to give a message, "The balance is insufficient for the specified withdrawal".
  5. Create a structure, employee that holds information like employee code, name, date of joining. Write a program to create an array of structure and enter 5 records into it. Then ask the user to enter current date. Display the names of those employees whose tenure is 3 or more than 3 years according to the given current date.
  6. Write a menu driven program that depicts the working of a library. The menu options should be:
    1. Add book information
    2. Display book information
    3. List all books of given author
    4. List the title of specified book
    5. List the count of books in the library
    0. Exit
    Create a structure called library to hold accession number, title of the book, author name, price of the book, and flag indicating whether book is issued or not.