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)CODING ARENA::
#include <stdio.h>
#include<string.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("\nName=%s",s.name);
printf("\nRoll number=%d",s.roll);
printf("\nMarks=%.2f",s. marks);
return 0;
}
Test Case 1
Input (stdin)Bogar 2000 99.51
Expected OutputName=Bogar Roll number=2000 Marks=99.51
Test Case 2
Input (stdin)Tamil 1000 99.99
Expected OutputName=Tamil Roll number=1000 Marks=99.99
No comments:
Post a Comment