The document contains multiple Java programming examples, including implementations for calculating Fibonacci numbers, checking for prime numbers, computing factorials, printing half pyramids using numbers, and generating multiplication tables. Each example includes code snippets and expected outputs. Additionally, there is a program to find the average of numbers using an array.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
1 views6 pages
Java Basic Programmers Handwritten Note
The document contains multiple Java programming examples, including implementations for calculating Fibonacci numbers, checking for prime numbers, computing factorials, printing half pyramids using numbers, and generating multiplication tables. Each example includes code snippets and expected outputs. Additionally, there is a program to find the average of numbers using an array.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 6
I}. [FrRRONACCT SERIES IN JAVA:
=> Class PibonacciExample €
Public static yotd main Cstving azgs CI By
int p26. ino ne eijeeeult =10 5
System.out-PrintC nit" "“+n2 ) 7
foxCi=o) ic counts ++ 1)
{13 = nicki
system.our. print " +n3 ) >
nb = 92>
N2= N33
¥
Ds
y
Output:
On|) BP eek aie a.
2). [Prime Nomger PROGRAM IN JAVA?
cD Public class Primenumbexs £ 2
Puplic static void main (string aygs C1 )
int i, M=O , Count= 0;
Int n= 5
M=n/2)
i(Cn==o |lne=1 ><,
4 System. our, pyintin (nets not pyime num”) 5ewe £
for Ci=25_icem3 jer) <
F GE Cine cea fis eee)
tr
System.out pyintin Cnt" ts not pxime number”)5) |
counts!_5
breals 5
*
Pe
iC Flag = 20) € “
system-out-pyintin(n + is paime number") 5
it
a
Output’:
A_is prime number
3).
oD Cross factosialéxampie f.
Public static void main (stying axgs Li)
{oti_,.-Fact = hy,
IntCizt 5 is=numbevs tar) £
Fact = fact * {3
,
System.out pyintin C factorial of +"number +"
1s" + Fact 25
| oe
1
Oot
= oe lal we. pence4)-
=) Public class main £
Public. static void main ( stving LI) aygs ) ¢
int yourse5 4
for(inriels i¢ = vows; ++i) £
forint Sete Se ee
System.out. pstntin (" % ") 5
System.out-pxintin Cy,
i
3s
Output t-
co
ax
aK
waR*w*K
aa kK
5). | PROGRAM to PRINT HAIF PYRAMID USING NOMBERS 7
=b
Public class main £
Fubiic static void malin ( stsing CL) axgs ) £
\it yous = 53
fox oti=15 Teo= rows; +rt) £
for(int Jal; TSE} p +e yy JE
System. our. printin€ ) 4
| eS oa
e sre >‘Output
{
\
1
\
1
ie
6).
=> Public class muttiptication Table £
Public static yvold main Ghingtiagd
int num = $3
F for(intiisi; is=ios ++ 1)
System-out. printin Cnd yd =7d Nn",
. num, i, numat)5
5
Be
Output tv
a
Se
AANANA HANAN
By Se ROOK be Bk Ne DRO be
Doedinmnicth PEJ. [PROGRAM TO FIND AVERAGE Of nlumBER USING ARRAY:
=> Pubtic class Javaexampie £
Public static void Malo (string Llaxgs )
double Clay = C14 , 12-89, 16-5 200, 13435
For (int i= 03 t< ayn; lenath ; itt )
total =+oral + ayy Tl J
double aveyvage = total f qyy- length 5
sustem.out-format (“
|
1}
@ onevage : /: 2F",
aveyage);q
Want Free
Notes, Resources, and
coding Courses??
Join our Channel
g
Link in Bio
SS