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

Assignment For 2nd Year Computer Science

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)
95 views1 page

Assignment For 2nd Year Computer Science

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 FOR 2nd YEAR COMPUTER SCIENCE

1. Write a program that asks the user to enter a number between 1 and 7 and prints the
corresponding day of the week using a switch statement

2. Write a program that asks the user to input an integer and checks if the number is positive,
negative, or zero using if-else statements. Print the result accordingly.

3. Write a program that reverses a number entered by the user using a while loop.

4. Write a program that checks whether a given year is a leap year or not. A year is a leap year if It
is divisible by 4. But, if it is divisible by 100, it must also be divisible by 400 Use if-else
statements to check this condition.

5. Write a program to print the Fibonacci sequence up to the n-th term, where n is entered by the
user.

6. Write a program that takes an integer as input and determines whether the number is prime or
not using an if-else statement.

7. Write a program that sums all numbers between x and y (inclusive), where x and y are user
inputs. If x is greater than y, print an error message.

Submission date: 10/04/2017

BY: BETHELHEM.W

You might also like