Web Hosting Talk







View Full Version : lesson 1 for learning C program


prince_sasa
11-05-2009, 07:10 PM
Hello All

i hope anyone here knows C well

i am in engineering faculty Computer department

so i am learning C at first 5 weeks and honestly i can't understand a single word from Professors

so i will post my sheet that i must answer and you try to solve it and the MOST important thing is to explain quite bit the solution

here are 7 problems
please help me in sloving them or at least couple of them
please don't forget to explain , consider me that i have 0% experience with C

1. Write a program that given the an integer N, draws a triangale having a base and a
height equals N. For example a triangle with base and height 4 will look like
*
**
***
****

2. Write a program that given an array of N integers, output the maximum number, the
minimum number and the average and sum of these numbers.

3. Write a program that given two integer numbers x ,y and z, displays all the numbers
that are divisible by z in the range between x and y inclusively. Note that x is not
necessary less than y.

4. A factory divides its workers into three skill levels. Unskilled workers receive L.E. 8.15
per hour, semiskilled workers receive L.E. 12.55 an hour, and skilled workers L.E. 18.60
an hour. Write a program to calculate a workers weekly pay formatted to two decimal
places. Your program input should consist of the hours worked and a skill level
indicator. The program should run until the user enters two zeros, then the sum of all
wages should be displayed.

5. A shop need to keep an inventory of its 100 items for sale. Write a program that uses
paralled arrays to input the item code, price and quantity of each item. Then the
program displays a neat table of all items whose price > 100 pounds. Then it displays
another table of all items whose quantity is less than 10 items.

6. Write a program that calculates how far a satellite travels in one rotation about the
earth, given the satellites altitude in kilometers. Use 6365 km as the earths radius.

7. Write a function called calculator that accepts two numbers and an operation ( + - * /
) of type char. The function body executes the operation and returns the result.

Thanks in advance for all people who will help me

cselzer
11-05-2009, 07:13 PM
Please read your text book.. whole way through if you have to.. not just once.. and don't read for word for word skip around read as much as possible and repeat this... or search for tutorials regarding basics of c language. And tell your school to skip c and go straight to c++ since c teaches you HORRIBLE habits for when you start getting into c++.

EDIT: If you start writing code, and need help, post your code and I will gladly assist you, but i can't help those who can't help themselves.. no offense.. I'm sure others would agree.

prince_sasa
11-05-2009, 07:17 PM
the problem is i have 7th week exam the week after next week
and also i must deliver 5 sheets to my professor about C
so i wanna anyone to help me a little as i was desperate to figure out anything alone at all

mwatkins
11-05-2009, 07:18 PM
so i will post my sheet that i must answer and you try to solve it and the MOST important thing is to explain quite bit the solution

Do you honestly believe that the right approach to doing your work is to have others do it for you?

What school are you attending, and what's your prof's name so we can alert them to this.

bear
11-05-2009, 07:19 PM
the problem is i have 7th week exam the week after next week

Then it's time to ask him/her for help. No, we will not do your homework for you.
</thread>