-
Notifications
You must be signed in to change notification settings - Fork 1
/
basic_gets.c
32 lines (30 loc) · 803 Bytes
/
basic_gets.c
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
#include <stdio.h>
int main() {
int id;
char name[50];
float marks;
char grade;
char discipline[50];
printf("Enter your id number: ");
scanf("%d", &id);
// Issue with string input?
getchar();
printf("Enter your name: ");
gets(name);
printf("Enter your discipline: ");
gets(discipline);
printf("Enter your marks: ");
scanf("%f", &marks);
// Issue with character input?
getchar();
printf("Enter your grade: ");
grade = getchar();
printf("\nYou have entered id as %d\n", id);
printf("You have entered name as ");
puts(name);
printf("You have entered discipline as ");
puts(discipline);
printf("You have entered marks as %f\n", marks);
printf("You have entered grade as %c\n", grade);
return 0;
}