Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

IoriMoe Nov 17th, 2018 83 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int a[28],b[4],e[28],f[28],g=0,i,j,k=0,sum[4]={0,0,0,0};
  6.    
  7.     printf("Please input inventory of Piels:");
  8.     scanf("%d",&b[0]);
  9.     printf("Please input inventory of Coors:");
  10.     scanf("%d",&b[1]);
  11.     printf("Please input inventory of Bud:");
  12.     scanf("%d",&b[2]);
  13.     printf("Please input inventory of Iron City:");
  14.     scanf("%d",&b[3]);
  15.    
  16.     for(i=0;i<7;i++)
  17.     for(j=1;j<5;j++,k++)
  18.     {  
  19.     printf(" the amount purchased of ID number %d:",j);
  20.     scanf("%d",&e[k]);
  21.     printf(" the amount sold of ID number %d:",j);
  22.     scanf("%d",&f[k]);
  23.     a[k]=a[k]+e[k]-f[k];  
  24.  
  25. }
  26. k=0;
  27.     for(i=0;i<7;i++,k++)
  28.     {
  29.         sum[0]=sum[0]+a[4k];
  30.         sum[1]=sum[1]+a[4k+1];
  31.         sum[2]=sum[2]+a[4k+2];
  32.         sum[3]=sum[3]+a[4k+3];
  33.        
  34.     }
  35.    
  36.     for(j=1;j<5;j++,k++,g++)
  37.     {
  38.     printf("The total inventory of ID number%d : %d\n",j,sum[g]+b[g]);
  39.  
  40.     }
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top