source code:
#include <stdio.h>
struct student {
char name[50];
int roll;
float marks;
} s;
int main() {
printf("welcome to a simple information collecting program designed by linux tech:\n");
printf("Enter information:\n");
printf("Enter your name: ");
fgets(s.name, sizeof(s.name), stdin);
printf("Enter roll number: ");
scanf("%d", &s.roll);
printf("Enter age: ");
scanf("%f", &s.marks);
printf("Displaying Information:\n");
printf("Name: ");
printf("%s", s.name);
printf("Roll number: %d\n", s.roll);
printf("age: %.1f\n", s.marks);
return 0;
}
Comments