forked from SarahN18/Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentdata.c
More file actions
48 lines (38 loc) · 915 Bytes
/
Studentdata.c
File metadata and controls
48 lines (38 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<stdio.h>
#include<string.h>
struct StudentData{
int rollNo;
char name[30];
int age;
float marks;
};
int main(){
struct StudentData abhirup;
//struct StudentData abhirup = {014,"Abhirup Saha",20,450};
abhirup.rollNo = 014;
//strcpy(abhirup.name,"Abhirup Saha");
printf("Enter your name: ");
fgets(abhirup.name, 30, stdin);
abhirup.age = 20;
printf("Enter marks:");
scanf("%f", &abhirup.marks);
//abhirup.marks = 450;
printf("\n%d",abhirup.rollNo);
printf("\nYour full name is %s",abhirup.name);
printf("%d",abhirup.age);
printf("\n%.1f",abhirup.marks);
return 0;
}
// #include<stdio.h>
// #include<string.h>
// typedef struct
// {
// int roll;
// float marks;
// }Student;
// int main(){
// Student akash;
// akash.roll=45;
// akash.marks=65.67;
// printf("%d %.2f",akash.roll,akash.marks);
// }