Control Flow
Write a program to find whether person is eligible to vote or not.
Input: age
Output:
Eligible for Vote
Not Eligible for Vote
Write a program to find a number whether it is Positive or negative
Input: number
Output:
Positive
Negative
Neither Positive or Negative
Write a program to find whether the number is divisible by 5
Input: number
Output:
Divisible
Not Divisible
Write a program to find a number whether it is odd or even. Zero is neither odd or even
Input: number
Output:
Even
Odd
Zero is neither odd or even
Find Student result based on total marks
Input: Total Marks
Output:
Print “Pass” if student got 35 marks or more than 35 marks
Otherwise print “Fail”
Print Day Names for the given number
Input: number
Output:
If given number is 1, print "Monday"
If given number is 2, print "Tuesday"
If given number is 3, print "Wednesday"
If given number is 4, print "Thursday"
If given number is 5, print "Friday"
If given number is 6, print "Saturday"
If given number is 7, print "Sunday"
Otherwise print, “Given number is invalid”
Give Grades for student based on below condition
Input: Total Marks
Output:
Total Mark is 100, print “A Grade”
Total Mark is above 90 , print “B Grade”
Total Mark is above 70 , print “C Grade”
Total Mark is above 35 , print “D Grade”
Total Mark is below 35 , print “Fail”
Write a program to calculate profit or loss
Input:
Buying Price
Selling Price
Output:
Print “Profit”, if selling price is more than buying price
Print “Loss” , if selling price is less than buying price
Fizz Buzz FizzBuzz
Input: number
Output:
Print “Fizz” If given number is divisible by 3
Print “Buzz” if given number is divisible by 5
Else Print “FizzBuzz”
Leap Year or Not
Input: Year Number
Output:
Conditions for Leap Year
Year should divisible by 4
Year should not be divisible by 100 only 400 is the exception
Example Inputs:
Example 1:
Input: 2022
Output: Not Leap Year
Example 2:
Input: 2020
Output: Leap Year
Example 3:
Input: 1900
Output: Not Leap Year
Last updated