Thread: Array help
View Single Post
Old 10-26-2005, 07:36 AM   #3 (permalink)
SweetOne
Registered User
 
Join Date: Oct 2005
Posts: 6
SweetOne is on a distinguished road
Here is my new code for the first one
PHP Code:
#include <stdio.h>

main()
{
  
  
char month[12][4];
  
int product[12];
  
float sales[12];
  
short i;

  
  for (
1<= 12i++) {
    
printf("\nEnter the month: ");
    
scanf("%s",month[i-1]);

    
printf("\nEnter number of products sold: ");
    
scanf("%d", &product[1]);
    
printf("\nEnter sales: ");
    
scanf("%f", &sales[1]);
  } 
for (
1<= 12i++) {
    
printf("\nMonth:%s ",month[i-1]);
    
printf("\nNumber of products sold:%d ",product[i-1]);
    
printf("\nSales:%.2f ",sales[i-1]);
  } 

  return(
0);

Never mind..I had a .2 in my scan float for sales. I fixed that and it works like a charm. Now I need help with my second programming code from above
SweetOne is offline   Reply With Quote