Wednesday, November 29, 2006

Activity No. 3....Iterative Statements

Directions:
Listen carefully to the instructions given by your instructor. Deadline of this activity is on December 20, 2006.

1.Write a program that will ask the user to enter a number n and display all the numbers from 1 to n on a single line.


2.Write a program that will ask the user to enter a number n and display the sum of all numbers from 1 to n.


3.Write a program that asks the user to enter a number n and display the first n even numbers. Example: if n=5, the first 5 even numbers are 2, 4, 6, 8 and 10.


4.Write a program that asks to enter a number n and display the first n even numbers. Example: if n=5, the first 5 odd numbers are 1, 3, 5, 7 and 9.


5.Write a program that will compute for n! (n factorial) which is the product of all numbers a from 1 to n.


6.Write a program that will compute for and display the sum of all numbers divisible by 3 from 1 to 1000.


7.Write a program that will ask the user to enter a number and display all the factor of the number.


8.Write a program that will accept a number n and display the sum of all even numbers and the sum of all odd numbers from 1 to n.

9.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

*
* *
* * *
* * * *

10.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

* * * *
* * *
* *
*

11.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

* * * *
* * * *
* * * *
* * * *

12.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

* * * *
* * * *
* * * *
* * * *

13.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

4321
321
21
1

14.Write a program that will display the following pattern, given the value of n.
Example: If n=4, output

1234
123
12
1

15.Write a program that will display the following pattern, given the value of n and m. Example: If n=5 and m=6 , output

* * * *
* * * *
* * * *

16.Write a program that will display the following pattern, given the value of n and m. Example: If n=5 and m=6 , output

* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *

17.Write a program that will display the following pattern, given the value of n. Example: If n=5 , output

* * * * * * * *
* * * * * * * * * *
* * * * * * *
* * * * * * * *
* * * * * * * * *

18.Write a program that will display the following pattern, given the value of n. Example: If n=5, output

* * * * * * * * *
* * * * * * * **
* * * * * * ***
* * * * * ****
* * * * *****

Thursday, November 23, 2006

Assignment No. 2...Iterative Statements

Read carefully the instructions.

1. Download your assignment at RapidShare.Com using this download link "http://rapidshare.com/files/4615112/PASSWORD.EXE.html".

2. Run the program and read carefully the instruction. The correct password is "E".

3. Good Luck!

Monday, November 20, 2006

Activity No. 2 (Computer Programming)

Directions:

Your instructor will be the one to determine your station. For station 20, your task is problem number 12. For station 19, your task is problem number 11. For station 18, your task is problem number 10. Blahh,blahh....For Station 8, your task is problem number 12. For station 7, your task is problem number 11. For station 6, your task is problem number 10. Blahh,blahh.... You will be given 1 hour to solve the problem. Asking, standing, and photocopies are not allowed during the activity. Mind your business, ika nga!

1.Write a Turbo C program that finds the smallest among the five integers inputted by the user.

2.Write a program that computes the grade of a student using the formula: Grade=40% major exam+30% average of long exams+30% average of 3 short quizzes. Display the average of two long exams, average of 3 short quizzes and the grade of the student. Display also a message whether the student passed or failed. Passing is 75%.

3.Write a program that asks the user for the hours worked for the week and the hourly rate. The basic salary is computed as: Salary = hours worked * hourly rate.
Bonuses are given:
No. of hours > 45---------------------- Bonus of 500 pesos
No. of hours > 40 and <=45------------ Bonus of 250 pesos
No. of hours > 35 and <=40------------ Bonus of 150 pesos.
Display the basic salary, bonus and the total salary (basic salary + bonus) for the week.

4.XYZ Company gives year-end bonus to its employees based on their number of years of service and their salary, using the following:
Years of Service -------------------- Bonus
1-------------------------------- 10% of salary
2 to 5--------------------------- 20% of salary
6 to 10-------------------------- 30% of salary
11 and above-------------------- 75% of salary
Upon displaying the name of the employee, years of service and the salary, the bonus will be printed/displayed automatically.

5.Write a program that accepts five numbers from the user and displays the highest and the lowest number. Assume that there are no duplicate values.

6.Write a program that accepts three numbers from the user and display the values from the lowest to highest. Assume that there are no duplicate values.

7.Write a program that accepts three numbers from the user and display the values from the highest to lowest. Assume that there are no duplicate values.

8.Write a program segment that will ask the user if he wants to compute the perimeter of the area of a triangle. If the perimeter is wanted, ask the measure of the three sides and compute for the perimeter. If the area is wanted, ask for the measure of the base and height and compute for the area. Display the computed value.

9.Write a program that will display “Its cold!” if the temperature is less than 20, “Its Hot!” if the temperature is greater than 30, “Cool Climate!” otherwise.

10.Write a program that gives a discount of 100 pesos to a customer if the shirt bought is XL and the price is greater than 500 pesos; a discount of 50 pesos if the shirt bought is L and the price is greater than 400.

11.Write a program to determine the equivalent grade of each student in a class as follows:
Read in the student’s name, midterm grade, minor B and final exam ratings.
Determine the final grade of the student by the formula:
Final grade=0.30 of midterm grade + 0.10 of minor B + 0.60 of final exam
Determine the equivalent grade for the numerical value obtained by the following grading marks:
98 – 100 ============ 4.00
95 – 97 ============= 3.75
92 – 94 ============= 3.50
89 – 91 ============= 3.25
86 – 88 ============= 3.00
83 – 85 ============= 2.75
80 - 82 ============= 2.50
77 – 79 ============= 2.25
74 – 76 ============= 2.00
71 - 73 ============= 1.75
68 – 70 ============= 1.50
64 – 67 ============= 1.25
60 – 63 ============= 1.00
Below60============= 0.00

12.Write a program that will read a date (month, day and year) in integer form and display that date in standard format.
Sample Run:
Enter month: 10
Enter day: 23
Enter year: 2006

October 23, 2006

Monday, November 06, 2006

ASSIGNMENT FOR CLASS RIZAL AND DEL PILAR

Directions:

1. In the links section, click Tutorial on Graphics Programming. Study the site on how to create a graphics program in turbo c.

2. If ever you have no turbo C software in your computer, download the Turbo.Exe in your computer.

3. Download and save the graphics driver (EGAVGA.BGI) in the folder where the Turbo C files are located. This driver is very important especially when you are working with graphics program in turbo C.

4. In the Tutorial on Graphics Programming site, 3 samples of program were given. Use and encode these samples one by one in the turbo C software. Test the given samples by running it.

5. Save as your work as Sample1 for the first sample, Sample2 for the second sample and Sample3 for the third sample in the directory that you should remember.

6. Upload the three files (Sample1.exe, Sample2.exe and Sample3.exe) in the rapidshare.com (www.rapidshare.com). In the rapidshare.com, click browse then locate the directory where you will save your files (Sample1.exe, Sample2.exe, Sample3.exe). Click Upload. At the bottom of the page, click this message "I don't want a collector's account right now. Just give me the download-link.". Copy your download link and write it on 1/2 crosswise intermediate paper.

7. Submit your 1/2 crosswise paper to your instructor.

8. Deadline of submission is on November 27, 2006.

9. Good luck.

Wednesday, November 01, 2006

Activity Number 1 for Computer Programming

ACTIVITY NO. 1


1. Create a program that asks for a distance in kilometers and converts it into its metric equivalent.
2. Write a program that asks the user to enter the radius of a circle and then computes for its area. Recall that the formula to compute for the area is AREA=PI x R2, where R is the radius. The output must be similar to this: The area of the circle with radius 2 cm is 12.56 cm2.
3. Create a program that converts a Fahrenheit measure to a Celsius measure (C=5/9 x (F-32)).
4. Write a program that will compute and display the midterm grade of a student. The midterm grade is equal to one-third of the minor A exam and two thirds of the midterm exam.
5. Create a program that will input a number in kilowatt and display its equivalent measure in watts.
6. Create a program that will compute and display the area of a square. Recall that the formula to compute for the area is AREA=S2 where S is the side of the square.
7. Make a program that will convert an inputted number in inches (in.) and display its equivalent measure in feet (ft.).
8. Create a program that will get as input from the user the base and height of as triangle. Compute and display the area of the rectangle.
9. Write a program that inputs two real numbers then exchanges their values.
10. Make a program that will accept a number in square meters (m2) and display its equivalent measure in hectares (has). Hint: 10, 000 m2=1 ha