Professional Documents
Culture Documents
Assignment ICT by M.Saoodulhassan
Assignment ICT by M.Saoodulhassan
Assignment ICT by M.Saoodulhassan
7. Else
7. Else
4. Else
Output : (Odd
4. Else
Output : n (not a leap year)
7. Pseudo-code to covert temperature from Celsius to Fahrenheit:
1. Make two variables (c, f)
2. Input : c (temperature In Celsius)
3. Compute f = (c*9/5) + 32
4. Output : f (temperature in Fahrenheit)
8. Pseudo-code to check if a number is prime:
1. Make three variables (x, y, z)
2. Input : x (num1)
3. Set y to True (assuming x prime until proven otherwise)
4. If x <= 1 , Set y to False
5. For each value of z from (2 to x-1):
If x is divisible by z , Set y to False
6. Exit the loop
7. If y is true then
Output : x is a prime number
8. If y is false then
Output : x is not a prime number
9. Pseudo-code to calculate reverse of a number:
1. Make two variables (x, y)
2. Input : x (num1 to reverse)
3. Initialize y (reversednum) to 0
4. While x is greater than 0 :
- Get last digit of x (remainder when divided by 10)
- Append last digit to y
- Remove last digit from x
5. End While
7. End While