Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

Java Basics Programs -Pattern And Loop Concepts

Rating
-
Sold
-
Pages
31
Uploaded on
30-10-2021
Written in
2021/2022

This notes or programs helps you to understand the conditional and loop concepts and pattern programs

Institution
Course

Content preview

Questions:
1. Write a Java program to get a number from the user and print whether it is
positive or negative.
2. Take three numbers from the user and print the greatest number.
3. Write a Java program that reads a floating-point number and prints "zero" if the
number is zero. Otherwise, print "positive" or "negative".
Add "small" if the absolute value of the number is less than 1, or "large" if it
exceeds 1,000,000.
4. Write a Java program that takes the user to provide a single character from the
alphabet.
Print Vowel or Consonant, depending on the user input.
If the user input is not a letter (between a and z or A and Z), or is a string of length
> 1, print an error message.
5. Write a program in Java to display n terms of natural numbers and their sum.
6. Write a program in Java to input 5 numbers from keyboard and find their sum
and average.
7. Write a program in Java to display the cube of the number upto given an
integer.
8. Write a program in Java to display the multiplication table of a given integer.
9. Write a program in Java to display the n terms of odd natural number and their
sum.

,10. Write a program in Java to display the pattern like right angle triangle with a
number.
1
12
123
1234
12345
123456
1234567
12345678
123456789
12345678910
11. Write a program in Java to make such a pattern like right angle triangle with a
number which will repeat a number in a row.
The pattern is as follows :
1
22
333
4444


12. Write a program in Java to make such a pattern like right angle triangle with
number increased by 1.The pattern like

,1
23
456
7 8 9 10




13. Write a program in Java to make such a pattern like a pyramid with a number
which will repeat the number in the same row.


1
22
333
4444




14. Write a program in Java to print the Floyd's Triangle.
Input number of rows : 5
1
23
456
7 8 9 10
11 12 13 14 15

, 15. Write a program in Java to display the pattern like a diamond.
Input number of rows (half of the diamond) : 7
Expected Output :
*
***
*****
*******
*********
***********
*************
***********
*********
*******
*****
***
*




16. Write a Java program to display Pascal's triangle.

Written for

Course

Document information

Uploaded on
October 30, 2021
Number of pages
31
Written in
2021/2022
Type
OTHER
Person
Unknown

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
amitghagare

Get to know the seller

Seller avatar
amitghagare Teachme2-tutor
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
4 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions