6. Write a program to read RollNo, Name, Address, Age & average-marks of 12 students in the BCT class and display the details from function.
Answers
Answer:
Step-by-step explanation:
\begin{gathered}speed = \frac{distance}{time} \\ 75km/h = \frac{133.5km}{time} \\ time = \frac{133.5km}{75km/h} \\ time = 1.78h\end{gathered}
speed=
time
distance
75km/h=
time
133.5km
time=
75km/h
133.5km
time=1.78h
input
#include <stdio.h>
struct student {
char name[50];
int roll;
float marks;
} s;
int main() {
printf("Enter information:\n");
printf("Enter name: ");
fgets(s.name, sizeof(s.name), stdin);
printf("Enter roll number: ");
scanf("%d", &s.roll);
printf("Enter marks: ");
scanf("%f", &s.marks);
printf("Displaying Information:\n");
printf("Name: ");
printf("%s", s.name);
printf("Roll number: %d\n", s.roll);
printf("Marks: %.1f\n", s.marks);
return 0;
}
output
Enter information:
Enter information:Enter name: Jack
Enter information:Enter name: JackEnter roll number: 23
Enter information:Enter name: JackEnter roll number: 23Enter marks: 34.5
Enter information:Enter name: JackEnter roll number: 23Enter marks: 34.5Displaying Information:
Enter information:Enter name: JackEnter roll number: 23Enter marks: 34.5Displaying Information:Name: Jack
Enter information:Enter name: JackEnter roll number: 23Enter marks: 34.5Displaying Information:Name: JackRoll number: 23
Enter information:Enter name: JackEnter roll number: 23Enter marks: 34.5Displaying Information:Name: JackRoll number: 23Marks: 34.5