PROGRAM
Programs to read sales of 5 salesman in 12 months and to print total sales madeby each salesman#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
int main()
{ system("cls");
int sales[5][12];
int i,j,total;
for(i=0;i<5;++i)
{ total=0;
cout<<"Enter sales for salesman"<<i+1<<":\n";
for(j=0;j<12;j++)
{ cout<<"\nMonth"<<j+1<<":";
cin>>sales[i][j];
total=total+sales[i][j];
}
cout<<"\n";
cout<<"Total sales of salesman"<<i+1<<"="<<total<<"\n";
}
getch();
return 0;
}
========================================================================
OUTPUT
Sample run for 2 salesmen,for 6 months
Enter sales for salesman1:
Month1:1000
Month2:1200
Month3:2200
Month4:3300
Month5:1100
Month6:1150
Total sales of salesman1=9950
Enter sales for salesman2:
Month1:1500
Month2:1000
Month3:1100
Month4:1150
Month5:1200
Month6:1050
Total sales of salesman2=7000
========================================================================
No comments:
Post a Comment