Posts

Showing posts with the label Multidimensional array

Multidimensional array in c

A multinational company has hired 3 sales persons for marketing/selling its 3 different products in Kathmandu .Each sales person sells each of these products. Write a c program to read number of each product sold by all sales-persons. Calculate total sells of each item and the total sells of each sales-person . Use array C Program source code #include <stdio.h> #include <conio.h> #include <string.h> int main() { int pro[3][3],sum=0; int j ,i ; char per[3][10]={ "first","second","third"}; for (i=0 ; i<3 ; i++) { for(j=0 ; j<3 ; j++) { printf("enter number of selling of %s person %s product:" , per[i] ,per[j] ); scanf("%d", &pro[i][j]); printf("\n"); } } for (i=0 ; i<3 ; i++) { for(j=0 ; j<3 ; j++) { sum = sum + pro[j][i]; } printf("Total sell of %s item is:%d\n",per[i], sum); sum=0; } for (i=0 ; i<3 ; i++)