Assignment 1.
Basics (variables)
1. Write a program to swap value of two variables without using third variable.
Note: don’t use a built-in function to swap the two numbers.
2. Write a program which accepts a character and display its next character
For Example if the user insert ’a’ your program should display ‘b’ (which is
the next character for ‘a’)
Flow of control (use if and switch for the following)
3. Write a program that accepts any integer from the user to find out its
absolute value.
Note: don’t use a built-in function. For Example if the user insert ’-1’ your
program should display ‘1’
4. If the ages of Anteneh, Ruta and Jemal are inputs from the user, write a
program to determine the youngest of the three.
For Example if the user insert ’23 43 12’ your program should display
‘Jemal is the Youngest’
5. A triangle is valid if the sum of all the three angles is equal to 180 degrees.
Write a program to check whether a triangle is valid or not, when the three
angles of the triangle are entered by the user.
6. Any character is entered by the user; write a program to determine whether
the character entered is a capital letter, a small case letter, a digit or a special
symbol. The following table shows the range of ASCII values for various
characters.
Characters ASCII Values
A–Z 65 – 90
a–z 97 – 122
0–9 48 – 57
special symbols 0 - 47, 58 - 64, 91 - 96, 123 – 127