Exercises
Write a program to compute the area of a triangle.
Create a program that reads in a first name and a last name and outputs the name in the form “Last, First.”
Read in a set of numbers and average them.
Given a series of numbers, write a program that prints the largest and smallest values.
Write a four-function calculator. This program takes an operator (one line of input) and a value (another line) and outputs a result. Hint: Use the string equality operator; check for the entered operator. A simple run is shown here:
Zero now is in stack Enter operator: + Enter value: 100 Result: 100 Enter operator: * Enter value: 2 Result: 200 Enter operator: / Enter value: 4 Result: 50
Get Perl for C Programmers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.