#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
#include <string.h>
struct date
{
int d, m, y;
};
struct student
{
char name[50];
int rollno;
char divi[50];
float marks;
char mobile_no[50];
};
struct st2
{
char name2[40];
int rollno_1;
char divi_1[40];
float marks_1;
char mobile_no_1[40];
};
struct date_1
{
int d, m, y;
};
int main()
{
struct student s;
printf("Enter the first student information: ");
printf("\nEnter the name of the student: ");
scanf("%[^\n]", s.name);
printf("Enter the roll numner of the student: ");
scanf("%d", &s.rollno);
printf("Enter the division of the student: ");
scanf("%s", s.divi);
printf("Enter the marks of the student: ");
scanf("%f", &s.marks);
printf("Enter the mobile number of the student: ");
scanf("%s", s.mobile_no);
struct date d;
printf("enter the student Date Of Birth: \n");
printf("DAY: ");
scanf("%d", &d.d);
printf("MONTH: ");
scanf("%d", &d.m);
printf("YEAR: ");
scanf("%d", &d.y);
printf("----------[%s] racord----------\n", s.name);
printf("| student name is: %s\n", s.name);
printf("| student roll no is: %d\n", s.rollno);
printf("| student division is: %s\n", s.divi);
printf("| student marks is: %f\n", s.marks);
printf("| student nmobile number is: %s\n", s.mobile_no);
printf("| student birth date is: %d/%d/%d\n", d.d, d.m, d.y);
struct st2 f;
printf("Enter the Second student information: ");
printf("\nEnter the name of the student: ");
scanf(" %[^\n]",f.name2); // added space before %[^\n]
printf("Enter the roll number of the student: ");
scanf("%d", &f.rollno_1);
printf("Enter the division of the student: ");
scanf("%s", f.divi_1);
printf("Enter the marks of the student: ");
scanf("%f", &f.marks_1);
printf("Enter the mobile number of the student: ");
scanf("%s", f.mobile_no_1);
struct date_1 b;
printf("enter the student Date Of Birth: \n");
printf("DAY: ");
scanf("%d", &b.d);
printf("MONTH: ");
scanf("%d", &b.m);
printf("YEAR: ");
scanf("%d", &b.y);
printf("----------[] racord----------\n");
printf("| student name is: %s\n", f.name2);
printf("| student roll no is: %d\n", f.rollno_1);
printf("| student division is: %s\n", f.divi_1);
printf("| student marks is: %f\n", f.marks_1);
printf("| student nmobile number is: %s\n", f.mobile_no_1);
printf("| student birth date is: %d/%d/%d", b.d, b.m, b.y);
return 0;
}
Output:
Enter the first student information:
Enter the name of the student: can yaman
Enter the roll numner of the student: 72
Enter the division of the student: a
Enter the marks of the student: 98
Enter the mobile number of the student: 6244738358
enter the student Date Of Birth:
DAY: 31
MONTH: 5
YEAR: 1993
----------[can yaman] racord----------
| student name is: can yaman
| student roll no is: 72
| student division is: a
| student marks is: 98.000000
| student nmobile number is: 6244738358
| student birth date is: 31/5/1993
Enter the Second student information:
Enter the name of the student: Enter the roll number of the student: