Week3 240801095
Week3 240801095
Example: II 698 and 768 are given, program should print true as they both end with 8.
Sample Input 1
25 53
Sample Output 1
false
Sample Input 2
27 77
Sample Output 2
true
Task
Given an integer, n, perform the following conditional actions:
If n is odd, print Weird
Complete the stub code provided in your editor to print whether or not n is weird.
Input Format
A single line containing a positive integer, n.
Constraints
1<n<100
Output Format
Print Weird if the number is weird; otherwise, print Not Weird.
Sample Input 0
3
Sample Output 0
Weird
OUTPUT:
Sample Input 1
3
Sample Output 1
Yes
OUTPUT:
Week:03-02
Sample Input 1
3
Sample Output 1
Triangle
Sample Input 2
7
Sample Output 2
Heptagon
Sample Input 3
11
Sample Output 3
The number of sides is not supported.
OUTPUT:
Year Animal
2000 Dragon
2001 Snake
2002 Horne
2003 Sheep
2004 Monkey
2005 Rooster
2006 Dog
2007 Pig
2008 Rat
2009 Ox
2010 Tiger
2011 Hare
Write a program that reads a year from the user and displays the animal associated with that year.
Your program should work correctly for any year greater than or equal to zero, not just the ones
listed in the table.
Sample Input 1
2004
Sample Output 1
Monkey
Sample Input 2
2010
Sample Output 2
Tiger
OUTPUT:
Q3) Problem Statement:
Positions on a chess board are identified by a letter and a number. The letter identifies the
column, while the number identifies the row,
Write a program that reads a position from the user. Use an if statement to determine if the
column begins with a black square or a white square. Then use modular arithmetic to report the
color of the square in that row. For example, if the user enters al then your program should report
that the
square is black. If the user enters d5 then your program should report that the square is white. Your
program may assume that a valid position will always be entered. It does not need to perform any
error checking.
Sample Input 1
A1
Sample Output 1
The square is black.
Sample Input 2
D5
Sample Output 2
The square is white.
OUTPUT:
Week:03-03
There are two calendars - one for normal years with 365 days, and one for leap years with 366 days.
Leap years are divisible by 4. Centuries, Cent like 1900, are not leap years unless they are divisible by
400. So, 2000 was a leap year.
To find the day of year number for a standard date, scan down the Jan column to find the day of
month, then scan across to the appropriate month column and read the day of year number.
Reverse the process to find the standard date for a given day of year. Write a program to print the
Day of Year of a given date, month and year
Sample Input 1
18
2020
Sample Output 1
170
OUTPUT:
Input Format
Name of shape (always in upper case R -> Rectangle, S--> Square, T->Triangle)
Length of 1 side
Length of other side
Note: In case of triangle, you can consider the sides as height and length of base
Output Format
Print the area of the shape.
Sample Input 1
T 10
20
Sample Output 1
200
OUTPUT:
Input format:
Contain a number n (0 <n)
Output format:
Print the name of the day you are arriving on
Sample Input
7
Sample Output
Kryptonday
Sample Input
1
Sample Output
Monday
OUTPUT: