0% found this document useful (0 votes)
47 views1 page

Assignment 1

This document contains an assignment with 6 programming problems covering basic variables, flow control using if and switch statements, and character validation. The problems include swapping variables without a third variable, determining the next character, calculating absolute value without a built-in function, finding the youngest of three ages, validating triangles based on angle sums, and classifying characters as capital letters, lowercase letters, digits or symbols based on ASCII values.

Uploaded by

Abdulwahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Assignment 1

This document contains an assignment with 6 programming problems covering basic variables, flow control using if and switch statements, and character validation. The problems include swapping variables without a third variable, determining the next character, calculating absolute value without a built-in function, finding the youngest of three ages, validating triangles based on angle sums, and classifying characters as capital letters, lowercase letters, digits or symbols based on ASCII values.

Uploaded by

Abdulwahid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like