Subject: Re: HELP...C programing
To: EMRE Can <emrecik@hotmail.com>
From: Peter Seebach <seebs@plethora.net>
List: netbsd-help
Date: 11/06/2001 21:25:52
In message <F211ioLydaMX48949nh00019b23@hotmail.com>, "EMRE Can" writes:
>I am interested to get your help programming that involves this 2 question 
>on the bottom....I'll be really appricaite that.
>due by this Friday.

Why not submit these to comp.lang.c.moderated?  I'm sure you'd get a lot
of very funny answers.  You really ought to be doing your own homework,
though.

>1) Write a program that defines five integer variables and initialize them 
>to 1,10,100,1000 and 10000. If then prints them on a single line separated 
>by space characters using the decimal conversion code (%D) on the next line 
>with the float conversion code (%F)
>Note the differences between the results. How do you explain them?

This program invokes undefined behavior; whatever it does (if it is even
accepted by the compiler) is up to the implementor's good will.  Note that
NetBSD's default compiler will give you a warning (if you ask nicely)
about the incorrect program.  For extra credit, run it on each of the
architectures NetBSD supports, and see how the surprises you get change each
time.

>2) Write a program that prompts the user to enter quantity and cost. That 
>values are to be read into an integer named quantity and a float named unit 
>price define the variable and use only one statement to read the values. 
>After reading the values skip one line and print each value, with an 
>appropriate name, on a separate line.

This is easy to do a bad job of, and hard to do correctly.

-s