Programación en Lenguaje C COIS 115 Profesor: Gustavo Velez
Taller Tres COIS 115 Profesor: Gustavo Velez
Ejercicio Asignación Buscar el promedio de tres números –Definir variables Num1, num2 y num3 Avg –Entrar valores –Calcular promedio –Enseñar promedio
If statement
If statement - Example //calculate gross pay if (hours > 40) gross = hours * rate + (hours - 40) * rate / 2; else gross = hours * rate; //end if if (current > 0 && previous > 0 && current >= previous) { //calculate gallons used and water charge calculate(current, previous, RATE, gallons, charge); //display water bill displayBill(name, gallons, charge); } else Console::WriteLine("Input Error"); //end if
Ejercicio Payroll problem –To pay 1.5 times if the employee work over 40 hours
Ejercicio Sales Bonus –Sales upto $12,000, pay 12% of the sales –Over $12,000, pay 15% of the sales over $12,000
While statement
While statement - Example
Preguntas
Check-out +(Positive)∆ (Change) !