You are on page 1of 2

Program to Store Marks in an Array

#include<stdio.h>
#include<iostream.h>
#include<conio.h>
//Program to store marks of 5 students in an array
void main( )
{
clrscr( );
const int size=5;
float marks[size];

// Loop to read marks of 5 students [cin]

cout<<"\n---- Program to store marks of 5 students in an


array ---\n";
for(int i=0;i<size;i++)
{
cout<<"Enter the marks of student"<<i+1<<endl;
cin>>marks[i];
}
// Loop to print marks obtained [cout]
for(i=0;i<size;i++)
{
cout<<"Marks of student"<<i<<" are "<<marks[i]<<"\n";

}
getch( );
}

Output

You might also like