Saturday, August 18, 2018

STRUCTURE STUDENT

  • Problem Description

    Write a program that passes a pointer to a structure to a function which displays student fee course and fee details

    Input and Output Format:

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output.

    Mandatory:

    1. Create a Structure "Student"

    2. Create four structure variables as roll(int), name(char), course(char), fees(int)

    3. Create structure variables as "s1"

    4. Display the details using structurevariable.datamember

    Hint:
    s1.name

    Note: The structure variables, data members and structure name are CASE Sensitive.

    Follow the same case mentioned in the mandatory
  • CODING ARENA
  • #include <stdio.h>

    #include<string.h>
    struct student
    {
      int roll;
      char name[100];
      char course[100];
      int fees;
    }s1;  
    int main()
    {
    printf("Details of student");
      scanf("%d",&s1.roll);
      scanf("%s",s1.name);
      scanf("%s",s1.course);
      scanf("%d",&s1.fees);
      printf("\nRoll Number=%d",s1.roll);
      printf("\nName=%s",s1.name);
      printf("\nCourse=%s",s1.course);
      printf("\nFees=%d",s1.fees);
      return 0;
    }
  • Test Case 1

    Input (stdin)
    11001 John Phd 115000
    
    
    Expected Output
    Details of student
    
    Roll Number=11001
    
    Name=John
    
    Course=Phd
    
    Fees=115000
  • Test Case 2

    Input (stdin)
    11002 Raj Phd 112000
    
    
    Expected Output
    Details of student
    
    Roll Number=11002
    
    Name=Raj
    
    Course=Phd
    
    Fees=112000

No comments:

Post a Comment