The Artima Developer Community
Sponsored Link

Java Answers Forum
Help Me

1 reply on 1 page. Most recent reply: Apr 10, 2004 12:38 PM by twc

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Ahmad

Posts: 1
Nickname: lovemoon
Registered: Apr, 2004

Help Me Posted: Apr 9, 2004 8:45 PM
Reply to this message Reply
Advertisement
hello every body

I have a assiment in the borland

Q: a mail order house sells five different products whose retail pricesnare shown in the following table:

2.98 \ 1
4.50 \ 2
9.98 \ 3
4.49 \ 4
6.87 \ 5

write a program that reads a series of pairs of numbers as follow:
1- product number
2- Quantity sold for one day

answer:-


#include <stdio.h>
void main ()
{
int items_sold,units_sold,units,sold,units_1,units_2,u
nits_3,units_4,units_5;

pri ntf (" enter what items was sold today");
scanf ("%d",&items_sold);

while (items_sold != -1)
{
printf ("enter how many units of this item was sold");
scanf ("%d",&units_sold);

switch (items_sold){
case 1:
units_1 += units_sold;
break;


case 2:
units_2 += units_sold;
break;

case 3:
units_3 += units_sold;
break;

case 4:
units_4 += units_sold;
break;

case 5:
units_5 += units_sold;
break;
}

printf (" enter what items was sold today");
scanf ("%d",&items_sold);
}
}

thank you


twc

Posts: 129
Nickname: twc
Registered: Feb, 2004

Re: Help Me Posted: Apr 10, 2004 12:38 PM
Reply to this message Reply
It appears that you have come to a Java group with a C program. I'm not sure what you want.

Flat View: This topic has 1 reply on 1 page
Topic: my program is a mess!!! Previous Topic   Next Topic Topic: encoding and basic authentication header

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use