Wednesday, May 8, 2019

Student Management Systems

  • Problem Description

    1. In this program, create a structure, "student" 

    2. The structure has three members: name (string), roll (integer) and marks (float).

    Then, a structure variable "s" is created to store information and display it on the screen.

    3. Input the student information and display the details.

    Mandatory:

    1. Create a structure "student" and the structure variable as "s"

    2. Print the information using structurevariable.members 

    Example (s.name)
  • Test Case 1

    Input (stdin)
    Bogar

    2000

    99.51

    Expected Output
    Name=Bogar

    Roll number=2000

    Marks=99.51
  • Test Case 2

    Input (stdin)
    Tamil

    1000

    99.99

    Expected Output
    Name=Tamil

    Roll number=1000

    Marks=99.99
Solution

#include <stdio.h>
struct student
{
    char name[50];
    int roll;
    float marks;
} s;

int main()
{
    scanf("%s", s.name);

    scanf("%d", &s.roll);

    scanf("%f", &s.marks);

    printf("Name=");
    puts(s.name);

    printf("Roll number=%d\n",s.roll);

    printf("Marks=%.2f\n", s.marks);

    return 0;
}

No comments:

Post a Comment

Parity

Problem Description Ram and Sita playing the parity game. Two types of parity are there. One is odd parity and next is even parity. Ram will...