PPS Practical 49

PPS Practical 49
  • Aim: Write a program to read structure elements from keyboard.
  • Code:
    //For turbo C++ remove below comments
    #include <stdio.h>
    //#include<conio.h>
    struct student{
        int no;
        float marks;
    };
    void main()
    {
        struct student s;
        printf("Enter information:\n");
        printf("Enter roll number: ");
        scanf("%d", &s.no);
        printf("Enter marks: ");
        scanf("%f", &s.marks);
        printf("Displaying Information:\n");
        printf("Roll number: %d\n", s.no);
        printf("Marks: %.1f\n", s.marks);
    }
  • Output:
    Output of practical 49

Comments