Programming 200+
Programming 200+
1 -
Accept numbers from a user
2 -
Display three string “Name”, “Is”, “James” as “Name**Is**James”
3 -
Display float number with 2 decimal places using print()
4 -
Format variables using a string.format() method.
quantity = 3
totalMoney = 1000
price = 450
statement1 = "I have {1} dollars so I can buy {0} football for {2:.2f}
dollars."
print(statement1.format(quantity, totalMoney, price))
5 - Sum of two integers
6 - Print the messege along with values and sum
Ex - The sum of 45 & 12 = 57
7 - Accept two integers from user and print the sum
Ex - The sum of 45 & 12 = 57
8 - Accept the User's name, age and print in following manner
Ex - Hello Shery, you are 12 years old.
9 - Accept the length and width of a rectangle. Calculate & print the area and
perimiter.
10 - Solve Increment & decrement operator questions on
https://javaconceptoftheday.com/quiz-on-increment-and-decrement-operators/
11 - Accept the marks of Robert in three subjects Maths, Computer, English
respectively (each out of 100 ),
Write a program to calculate his total marks and percentage marks.
12 - Write a program to accept temperature in Fahrenheit & convert into Celsius.
(Look for the formula on internet)
13 - Accept the Principle amount, time & rate of interest and calculate the Simple
Interest
**CONDITIONAL STATEMENTS**
14- Take 3 int inputs from user and check and print the result.
all are equal
any of two are equal
( use && || )
15 - Accept two numbers and print the greatest between them
16 - Accept the gender from the user as char and print the respective greeting
message
Ex - Good Morning Sir (on the basis of gender)
17 - Extend the previous program and handle the wrong inputs.
Print Good Morning sir for input m or M & Good morning Maam for input F or f
else print Wrong Input
18 - Accept an integer and check whether it is an even number or odd.
19 - Accept name and age from the user. Check if the user is a valid voter or not.
Vaid - Hello Shery, You are a valid voter.
Invalid - Sorry Shery, you can't cast the vote.
Part 2 - Print after how many years the user will be eligible
20 - Accept the parameters and calculate the Compound Interest & print it on STDOUT
(Use Math class methods)
21 - Accept the three sides of triangle and calculate the area using herons formula
22 - Accept the value of a, b, c - The values in a quadratic equation and find its
roots.
23 - Accept a day number between 1-7 and print the corresponding dayname.
24 - Accept three numbers and print the greatest among them
25 - Accept a year and check if it a leap year or not (google to find out what's a
leap year)
26 - Write a program that will ask the user to enter his/her marks (out of 100).
Define a method that will display grades according to the marks entered as below:
Marks Grade
91-100 AA
81-90 AB
71-80 BB
61-70 BC
51-60 CD
41-50 DD
<=40 F
**ITERATIVE STATEMENTS**
34 -
Accept an integer and Print hello world n times
35 -
Print natural number up to n.
36 -
Reverse for loop. Print n to 1.
37 -
Take a number as input and print its table
5 * 1 = 5
5 * 2 = 10 ... up to 10 terms
38 - Arrange string characters such that lowercase letters should come first
39 - Count all letters, digits, and special symbols from a given string
Given: str1 = "P@#yn26at^&i5ve"
Expected Outcome:
Total counts of chars, digits, and symbols
Chars = 8
Digits = 3
Symbol = 4
40 - Print string in reverse,its length,in uppercase,lowercase and copy into
another string
41 - Count alphabets, digits and symbols from a given string
42 - Compare two strings
43 - Concatenate two strings
44 - Calculate Length of string
45 - Convert a string into upper case
46 - Copy a string from another string
47 - Convert a string into lower case
48 - Join two strings
49 - Count alphabets, digits and symbols from a given string witout using inbuilt
function
50 - Compare two strings without using inbuilt functions
51 - Count Vowels from given string
52 - Reverse a string
53 - Check string is Pallindrome or not**
54 -
Sum up to n terms.
55 -
Factorial of a number
56 -
Print the sum of all even & odd numbers in a range seperately.
57 -
Print all the numbers which are either divisible by 3 or 5 in a range
58 -
Print all the factors of a number.
58 -
Print the sum of all factors of a number, 50 - 1 + 2 + 5 + 10 + 25 = 43
59 -
Accept a number and check if it a perfect number or not.
A number whose sum of factors(excluding number itself) = Number
Ex - 6 = 1, 2, 3 = 6
60 - Seprate each digit of a number and print it on the new line
61 - Sum of digits of a number, 936 = 18
62 - Check if the number is Prime or not.
63 - Accept a number and print its reverse
64 - Accept a number and check if it is a pallindromic number (If number and its
reverse are equal)
Ex - 12321 - Rerverse - 12321
65 - Accept a number and check if it is a armstrong number (Sum of cube of all
digits will be equal to origional number)
Ex - 407 = 64 + 0 + 343 = 407
153 = 1 + 125 + 27 = 153
66 - Accept a number and check if it is a strong number or not (Sum of factorial of
each digit)
Ex- 145 = 1! + 4! + 5! = 145
67 - Accept a number and check if it is a Harshad number
Harshad number is a number or an integer which is completely divisible by sum
of its digits.
Ex - 24 = Sum of 2+4 = 6 & 24%6 = 0
68 - Automorphic number 5 = 25 = 625 = 390625
69 - Print hello until user gives wrong input using do while
70 - Make a choice based calculator using do while
71 - Write a program to print the sum of negative numbers, sum of positive even
numbers and the sum of positive odd numbers
from a list of numbers (N) entered by the user.
The list terminates when the user enters a zero.
72 - Choice based weeday
73 - Question 27 using Switch
74 - Choice calc
75 - Restuarent
76 - Right Triangle - Star
*
* *
* * *
* * * *
* * * * *
77 - Right Triangle - Number
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
78 - Right Triangle - Alphabet
A
A B
A B C
A B C D
A B C D E
79 - Inverted Right Triangle
* * * * *
* * * *
* * *
* *
*
80 - Mirrored Right Triangle
*
* *
* * *
* * * *
* * * * *
81 - Mirrored Inverted Right Triangle
* * * * *
* * * *
* * *
* *
*
82 - Triangle
*
* *
* * *
* * * *
* * * * *
83 - Inverted Triangle
* * * * *
* * * *
* * *
* *
*
84 - Diamond or Kite
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * *
* * * *
* * *
* *
*
85 - V - Min Height = 3
* *
* *
* *
* *
*
86 - X
* *
* *
*
* *
* *
87 - Hollow Rectangle
*****
* *
* *
* *
*****
88 - Take 2 numbers as inputs and find their HCF.
89 - Find the LCM of two numbers
90 - Fibonacci series - 0, 1, 1, 2, 3, 5, 8, 13, 21...
91 - Generate 4 digit OTP