QUESTION:
Write a program to accept the marks of five students in an Array and print them to the screen.
#include<stdio.h>
int main()
{
int marks[5];
for(int i=0; i<5; i++){
printf("Enter the marks for student %d :", i+1);
scanf("%d", &marks[i]);
}
for(int i=0; i<5; i++){
printf("The value of marks for student %d is : %d\n", i+1, marks[i]);
}
return 0;
}
OUTPUT--->
Enter the marks for student 1 :56
Enter the marks for student 2 :98
Enter the marks for student 3 :69
Enter the marks for student 4 :98
Enter the marks for student 5 :99
The value of marks for student 1 is : 56
The value of marks for student 2 is : 98
The value of marks for student 3 is : 69
The value of marks for student 5 is : 99
No comments:
Post a Comment