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>
int main()
{
struct student;
{
char name[50];
int roll_no;
float marks;
};
struct student s;
scanf("%s",s.name);
scanf("%d",&s.roll_no);
scanf("%f",&s.marks);
printf("Name=%s\n",s.name);
printf("Roll number=%d\n",s.roll_no);
printf("Marks=%.2f\n",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
This comment has been removed by the author.
ReplyDelete