leap year or not, divisible by 100 , 400(leap year)
divisible by 4 (non leap year i.e false
input:2016
output:true
code to display day name.
day_names= ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' , 'Sunday']
input:3
output:wednesday
Armstrong numbers between two intervals
Write a program to print all the Armstrong numbers in the given range
A to B(including A and B). An N-digit number is an Armstrong number if the number equals the sum of the Nth power of its digits.
Input
The first line has an integer
A. The second line has an integer B.
Output
Print all Armstrong numbers separated by a space.
If there are no Armstrong numbers in the given range, print
-1.
Explanation
For
A = 150 and B = 200
For example, if we take number 153, the sum of the cube of digits
1, 5, 3 is
13 + 53 + 33 = 153.
So, the output should be
153.
Sample Input 1
150
200
Sample Output 1
153
Sample Input 2
1
3
Sample Output 2
1 2 3
important: please tell me how can we print -1 if there is no armstrong number
When will the ‘while’ loop be preferred over the for loop? Mention the scenario and write the
programme to demonstrate this?
Write an algorithm that displays an equivalent color once an input letter matches its first character.
For example b for Blue, r for Red, and so on. Here are the given criteria: (The letters as an input data and the color as output information).
Letters Color
‘B’ or ‘b’ Blue
‘R’ or ‘r’ Red
‘G’ or ‘g’ Green
‘Y’ or ‘y’ Yellow
Other letters “Unknown Color”
write a menu-driven program that asks the user to select a favorite color from the given colors. Keep asking the user three times for selecting the color from the list of the available colors. Do this with the help of a suitable loop and switch statement. Finally, you have to display the three favorite colors of the user.
Write a C++ program using a nested for loop to create multiplication table.
sample Output:
1 2 3 4 5 6 7 8 9 10
6
7
8
9
10
Using while loop, write a C++ program that will allow the users to enter the number of quizzes to compute and the program will automatically compute the average of the quizzes.
Sample Output:
Output:
Enter Number of Quiz: 4
Quiz 1: 90
Quiz 2: 89
Quiz 3: 94
Quiz 4: 100
Average: 93
Write a c++ program to find the length of the skirting board.Where she wants to replace the old skirting board and the coving 2.7,4.1m 32m(All dimensions in Meter)with the door of 0.86 x 2.06meters
Number Game
write a program to print the following
Input
The first line input containing the comma separated integers.
The second line of input is integer.
Sample Input1
1,2,3
1
Sample Output1
2 3
1 2