0% found this document useful (0 votes)
74 views

Computer JAVA Part-1

This document contains 93 questions asking to write programs to perform various tasks like printing patterns, evaluating mathematical series, determining properties of numbers, manipulating strings, and more. The questions cover basic programming concepts like loops, conditional statements, functions, arrays, strings and involve tasks like input/output, calculations, pattern printing and logical reasoning.

Uploaded by

Subham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views

Computer JAVA Part-1

This document contains 93 questions asking to write programs to perform various tasks like printing patterns, evaluating mathematical series, determining properties of numbers, manipulating strings, and more. The questions cover basic programming concepts like loops, conditional statements, functions, arrays, strings and involve tasks like input/output, calculations, pattern printing and logical reasoning.

Uploaded by

Subham
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Question 1

Write a program to print the following.


1
12
123
1234
12345
1234
123
12
1
Question 2
Write a program to find the sum of the following series.
S=1*2+2*3+3*4+---------99*100

Question 3
Write a program to find the sum of the following series .
S=1!+2!+3!-------n!
( ​take n as input​)

Question 4
Write a program to print the fibonancci series upto the 40th term.

Question 5
Write a program to input a binary number and convert it to decimal number.

Question 6
Write a program to input a number and find whether it is an Armstrong number or not.

Question 7
Write a program to input a number and find its mirror image.

Question 8
Write a program to print the sum of squares of all even numbers from 1 to 100.

Question 9
Write a program to enter a decimal number and convert it into binary number.

Question 10
Write a program to enter an alphabet and determine whether it is a vowel or a
consonant.

Question 11
Write a program to enter a string and find the number of characters in it.
Question 12
Write a program to enter two strings and join them.

Question 13
Write a program to enter two strings and find whose length is bigger.

Question 14
Write a program to create an array to store 10 integers and print the largest integer
and the smallest integer in that array.

Question 15
Write a program to calculate the sum of all the prime numbers between the range of 1
and 100.

Question 16
Write a program to accept a sentence and print only the first letter of each word of the
sentence in capital letters separated by a full stop.
Example :
INPUT SENTENCE : “This is a cat”
OUTPUT : T.I.A.C.

Question 17
To print the Floyds triangle with N rows
Example: If N = 5, Output:
1
23
456
7 8 9 10
11 12 13 14 15

Question 18
Write a program to input a string and convert it into uppercase and print the pair of
vowels and number of pair of vowels occurring in the string.
Example:
Input:
"BEAUTIFUL BEAUTIES "
Output :
Pair of vowels: EA, AU, EA, AU, IE
No. of pair of vowels: 5

Question 19
Write a program to take a line as input and print each word and it's length.
Question 20
Write a program to take a line as input and print the mirror image of each word in it.

Question 21
Write a program to take a line as input and find whether it's each word is palendrome
or not.

Question 22
Write a program to take a word as input and print all the consonants .

Question 23
Write a program to enter 100 numbers and find the largest among them.

Question 24
Write a program to enter a line of text and find the number of vowels, consonants,and
digits in it.

Question 25
Write a program to print the following
@@@@
@ @@@
@@ @@
@@@ @
@@@@

Question 26
Write a program to enter a word and print it's first and last character.

Question 27
Write a program to enter a line and find the largest and shortest word as well as their
number of characters.

Question 28
Write a program to enter a word and print it after removing all the vowels.

Question 29
Write a program to print all the Mesernee number from 1 to 100.
(​Mersenee number =2n​ ​-1)

Question 30
Write a program to print all double digit Palprime numbers.
Question 31
Write a program to find the value of y.
y=½-¾+⅚-⅞---------n th term.

Question 32
Write a program to enter 5 characters and print it as a single word.

Question 33
Write a program to evaluate the following series.
⅓+⅖-3/7+4/11-5/13---------nth term

Question 34
Write a program to print the following.
1
4 9
16 25 36
49 64 81 100

Question 35
Write a program to print the following.
12345
1234
123
12
1

Question 36
Write a program to print the following.
1
01
101
0101
10101

Question 37
Write a program to print the following.
@
@
@
@
@
Question 38
Write a program to print the following.
1
121
12321
1234321

Question 39
Write a program to print the following.
#
##
###
####
#####
######

Question 40
Write a program to print the following.
######
#####
####
###
##
#

Question 41
Write a program to print the following.
1
22
333
4444
55555

Question 42
Write a program to print the following.
1
13
135
1357
13579
Question 43
Write a program to print the following.
#
#@
#@#
#@#@
#@#@#

Question 44
Write a program to print the following.
AAAAAA
BBBBB
CCCC
DDD
EE
F

Question 45
Write a program to print the following.
#####
# #
# #
# #
#####

Question 46
Write a program to print the following.
#@@@@@#
@#@@@#@
@@#@#@@
@@@#@@@
@@#@#@@
@#@@@#@
#@@@@@#

Question 47
Write a program to print the following.
@
@
@
@
@
Question 48
Write a program to print the following.
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

Question 49
Write a program to print the following.
@ @
@ @
@ @
@

Question 50
Write a program to print the following.
54321
4321
321
21
1

Question 51
Write a program to enter a number and find whether it is a Harshad number or not.
( ​If the number is divisible by the sum of its factors it is said to be a Harshad number.)​

Question 52
Write a program to enter the month of a year and print all the dates of that month.

Question 53
Write a program to enter the days and convert it into years.

Question 54
Write a program to evaluate the following series.
S= x+ 2x/x​2​ + 3x/x​3​ + ---------- nx/x​n

Question 55
Write a program to enter a number and find whether it is a disarium number or not.
(​Sum of the​ digits of​ the Number raised to​ ​position of itself equal to the number)

Question 56
Write a program to enter a string and find whether it is a palendrome string or not.
Question 57
Write a program to enter a string and find the ​ASCII ​code of each character.

Question 58
Write a program to evaluate the following series.
S= ⅖-10/17+26/37----------nth term .

Question 59
Write a program to enter the temperature in celcius and convert it into farheniet if the
temperature is greater than 98.6F display fever otherwise normal.

Question 60
Write a program to enter a number and find the absolute difference between the
number and it's mirror image.

Question 61
Write a program to print all the phythagorean triplets from 1 to 100.

Question 62
Write a program to print the following.
0
10
210
3210
43210

Question 63
Write a program to enter a number and find it is prime or composite.

Question 64
Write a program to enter two numbers and find their ​HCF ​and​ LCM.

Question 65
Write a program to enter a number and print the sum of its prime digits.

Question 66
Write a program to enter two numbers and swap them without using any third
variable.
Question 67
Write a program to print all the multiples of 7 from 1 to 100. Use do while.

Question 68
Write a program to enter a year and find whether it is a leap year or not.

Question 69
Write a program to enter three numbers and find the big, bigger,and biggest number
among them.

Question 70
Write a program to enter a string and find the number of duplicate characters in it.

Question 71
Write a program to enter 10 numbers if a number is repeated consecutively print it
only once.

Question 72
Write a program to print the following.
######
#####
####
###
##
#

Question 73
Write a program to print the following.
@@@@@@
@@@@
@@
@
Question 74
Write a program to print the following.
1
121
12321
1234321
123454321

Question 75
Write a program to print the following.
9876
543
21
0
Question 76
Write a program to print all the disarium numbers from 1 to 100.

Question 77
Write a program to enter a number and find it is a Happy number or an Unhappy
number.

Question 78
Write a program to print the following.
13579
1357
135
13
1

Question 79
Write a program to print the following.
1
131
13531
1357531
135797531

Question 80
Write a program to evaluate the following series.
S=1-4+9-16+----------------- nth term

Question 81
Write a program to enter two numbers and convert them into strings and then
concatenate them.

Question 82
Write a program to enter a number and find whether it is a perfect number or not.
(​Sum of the factors of the number other than the number is equal to the number​)

Question 83
Write a program to enter a number and find whether it is a Smith number or not.
(​Sum of the digits of the number is equal to the sum of the digits of the prime factorization)​

Question 84
Write a program to enter a number and find whether it is a multidigit number or not.
(​using while and without using while)​

Question 85
Write a program to enter a number and find whether it is a automorphic number or
not.
(​an automorphic number is a natural number in a given number base whose square "ends"
in the same digits as the number itself​)

Question 86
Write a program to print all the prime numbers from 1 to 1000.

Question 87
Write a program to enter a number and find whether it is a perfect number, if yes then
print it's reverse.

Question 88
Write a program to enter a number and find whether it is a pronic number or not.
( ​A pronic number is a number which is the product of two consecutive integers, that is, a
number of the form n(n + 1).)​

Question 89
Write a program to enter a number and find whether it is an ugly number or not.
(​Ugly numbers are positive numbers whose prime factors only include 2, 3, 5 .​)

Question 90
Write a program to enter a number and find whether it is an Sunny number or not.
(​ Any n number is a sunny number if the square root of the (n+1)is an Integer number.​)

Question 91
Write a program to enter a number and find whether it is an abundant number or a
deficient number.
(​an abundant number or excessive number is a number for which the sum of its proper
divisors is greater than the number itself.A number n is said to be Deficient Number if sum of
all the divisors of the number denoted by divisorsSum(n) is less than twice the value of the
number n.)​

Question 92
Write a program to print the following :-
2,1,3,4,7,11 ---------nth term.

Question 93
Write a program to print all the numbers from 1 to 100 except the palindrome
numbers.

Question 94
Write a program to enter any two angles of a triangle and print weather it is a right
angle triangle or not.

Question 95
​ ath.PI ​.(​ take radius as input )​
Write a program to find the perimeter of a circle using M
Question 96
Write a program to enter 100 numbers and print the smallest and biggest number
among them without using any constant, such as, 32767.

Question 97
Write a program to enter a number and find it's logarithmic value.

Question 98
Write a program to enter a name and find its short signature.
(I) if it's Subham Chhotaray print S.Chhotaray
(II) if it's Subham Chhotaray print Chhotaray.S

Question 99
Write a program to print "hoo" from "school" using substring function.

Question 100
Write a program to enter a number and if the number is positive print it's logarithmic
​ se Math functions in both cases)​
value, else if it's negative find its positive value.(u

You might also like