You are on page 1of 8

Page No.

:
youvA|
Dato:

Name Kumbha8 pooja pan jabsao


Sead No0 20+0o
class Bcs IIT
Sub Java

. site a poogdam in Java to tind Factouiad of given


numbea using ooP Stament

Algoithm

Step stast
SteP 2 Tead numbe e
SteP 3 set Fact , iz
Step4 check condition ix: numbet if false go to
Step 7
step 5 Foct Fact i
step 6 updade ia it 90 to Step
Step 7 Display Foct
Step 8 stoP
Page No.:
YouvA
0ate

Flow Chast

Read numbe &

Fact L

NO
Tum

Yes
Fact. Fact * I

ispla y Fact
Page No.: YoUvA
Date:

Poogsam

alassFacBosial Example

Public stotic Void


main Sming adgs LD

int i Fact i
int numbea S
to calculate Factrooia
l l t i 9 the numbe&

Foe Ci - 1 , i<
numbe8 I** )

Fact Fact*i

3 pinHn tactoaial oF + numbea +" iS:"


System.ouf.
+Fact

Output

S 120
Factosial of 5
Pago No.
Date: YouVA

&.2 alsile a pogsam in java to disp)o y 9iven 8ting

in seesse osde &

Algosihm '

Stepi- stast
Step 2 Read the 8taing Fsom the use

SteP 3 Calculale the length oP he Stoing


step ev *" Cemphy stin9J
TniHalize
Step S Initiali2e i Qengh
SteP 6 Repea untHl i7 =O
dev Tev + ehasacte & a
6 2 i-1

ivoe*
Step 7 PTint TEV

Step 8 StoP
Page No.
YouvA
Date

Flo chast

Stost

Read 4he stoing fsorm


he use8

calculate h e length of

the shsin g

Initialize dev a s a n

empty stsing

initiadize i- length -

Tev-oeV * Charsacte& a
Posiior i) of h e sOng

Decement i ' by 4

yeg
is i > o
NO
/ psint sev

stoB
Page No.
YouvA|
Dato:

p30gsam

Public Class Revesse

stahic Void main (Sting tl asgs )


Public

Stoing stongDseam big">


stodes the Jeverse of 9iven srsng
stnng Tevevsedes""

i- )
fos Cinti shsing length () -1 > i 7:0

Teves sed Str


- deveTSedShs stonq cha At Ci)'

3
System out paintIn "'ouginad stoing"
.
+ Slmin g ),

lDiSplays the deverse oP given S n g

System -out.paintn (" Reverse of given Shoin q : '


oevessed s r

output
osigina shing ream biq
Revesse of given sng gib maesd
Page No youv
Sechon L Date

ulsite in
.4
Foame
a
java psogsam to disploy
window with pink Golou& at
a String
backgso und

using ALJT.

psogsam

impost Java ouwt


impost Java.event

public class ain extends fsame

implements Mouselistenee

Label
Main C

Supea "AuT Fsame" ")_


new Label ()
Set Bounds (20.6o, 2so. 30)
s e Alignment (Label . CENTER),
this add (1)°,
this- set layout (nWl ),
his Setsi2e ( 300 30o),
this. Set visible ( toue ) ,
his addMauselistene8 ( this),
this. addwindowlistenee new windoww Adopteal)

public Void uindousClosing (windoweont )

dispose (),
Page No. YoUvA|
Date:

public Stahic Void main ( ogrsing ) osgs

ne main ( ,

Output:.

AMT Pink

Tbis js Jabel

You might also like