0% found this document useful (0 votes)
30 views6 pages

Java Assignment 2

The document contains Java programming examples that demonstrate how to take user input and perform calculations, such as displaying the square and cube of a number. It includes code snippets for reading integers, checking for odd or even numbers, and generating multiplication tables. The examples illustrate basic Java syntax and the use of the Scanner class for input handling.

Uploaded by

sucilas504
Copyright
© All Rights Reserved
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% found this document useful (0 votes)
30 views6 pages

Java Assignment 2

The document contains Java programming examples that demonstrate how to take user input and perform calculations, such as displaying the square and cube of a number. It includes code snippets for reading integers, checking for odd or even numbers, and generating multiplication tables. The examples illustrate basic Java syntax and the use of the Scanner class for input handling.

Uploaded by

sucilas504
Copyright
© All Rights Reserved
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
— “ ) Java ROMRAMMING A\sgtawneNnt- eC Nome $-Susend hes DATO: WH O88 24 Dee: Blech G+ Pog 09°20 8241061, I Woeke @ java Prumfon bo dfsploy @Re cum od dh owen number up be on inkenpn. Tempore Java. WHR. Stanner ; Public. Pudi ¢ ¢ ink 1, choy Execs { Skokie etd mon (Sting C3 orgs) a ' Systorn ouk pee (" Tapuk number of tours"); Seamnnr in = new Scannn (System. in); far nN =in.-nexkInk 0} i Veen; a4) System souk. prtnkln (oNumbes ti" tte ond Gul of ¥ 4 4 ies Ba (i®TeDS Oukput : Numbe, Number Num bea Num ber > Wout wrt ancl Cube of ty v4 G sand Cure of ir ig bb 53 and Cube of 34124 Wo 4 and Cubke of hin 2 64 a Jove pen to display FR pubtipl Catt on ot & oh en ‘akong | Srapolr Jaya. uri 2. Scanner -, Pubio clas Exercises £ Puli c Stalic vetd rratn (Shiny 63 gs) K Sconnn in = new Sanna (Sy [Link] System. ouk. Peak ("Input Re Ise turmber .");, Nak rut = inenextIat(r; Systorn. uk. priak ("Trpwe dhe Dd number), Yak Mums = Wn neakInkOs, System souk eee (A npuk aha Bea cee bere ")y ink nom = Vn. nertinkts> if (owe) > num 2) if Crum) > nin 3) System: out. ti tla (Re Qooterk: "bt nim 15, if Crom 2% num 1) id Cram 2 > eum) | Syskom. ok. Peinkty ("TRE gtealaue yh + num 2): td Crim > rams) i (rum 3S num) System. owe. petty Ci TRE gteakouk "4 num 2), | 3 3 | Oukput : | Trpuk TRE 1 Se Wmba 225 Trpur Re and Numb : ae \ Inpuk the Bed number: oq TRE oreekeut 289 2 Woke a Tava porisyrm — to display Taube of & giuen inkoger . Re ruth poeahion Joua- uKQ. Scanner ; Vmrouk Public class Exactacin Public Stake vEd mein (Sbing C3 ory) { Tak jin [Link]. pink (“Tapuk 4a nurben (Table be ba Cab edakoel):.*)5 Systorm . ouk . Unk (" Trek number oF tres"); Stannin in = Mow Stanna (System ind’, No = in -neakInk 005 Sxyskom + oe | px mela Orn )s fa (j= 0, 322m 4 5459 Bashers souk penkinCnet 4 jatehants); > es (Oubeud: | Tnpuk eRe nuenloen Bxo=08 oe Sx 2 =l0 Sx eb = 15 j Be oan pt | : | AWoile a Taue Propam teak Loo dia Sum of n ode notusl numb. Cenpotuk java ud. Sconnay 5 Puli « clay Exercimis Pe Public Static vdel main (Strangld 079) rere Foy Syskom. ak. pink ("aapuk rumba of tour We: '); f Starner | Im > Now Sconas (sustorn- in) n=: ins nok Tak (>, System. uk. po rtha (\n TRL odd numbey on PAKGety teens iat) 5 Systers ouk. pink (274-1), Sumas aP ints y System ok. pi akly (Veta Sum of cota Nakwrok Nuedn Bebo "tnt" badey 4 by N48), | 4 4 Oukpuk : “tacuk num ba 5F TAT “W LS Th odd Neher Or sow” the hun od ook Nokwul Norte bps term b:25 SlWoite a Java POtryARm Afak stoady a FLoabay - eeink | rus bon and pias “zor! 2€ te punbr eet | Diharucin, Peak" Peta" oo “nagabuc’. Add “small” Mik de Obs ctuka Vol of WR Mahe Hey than 1 en “boxe vif te Cx cnads 1/092, 088. Tenpotk Joa. URL. Serrar’, | Pubic daw Ex atin C Pubic Skake Vad moan (Stung C3 2499) x Seopa “ia s new Stannan (System-i9S Suyskorn: ouk prank (" tryeuk Volo +"); dowkle inpuk = in-enk Double), id Chapuk > ©) td Cinpuk 2 Vy Sy shen ok printle ("Port hue Seat rumbu > el id Gapuk & locoosd Sy stom. ok .peinkty ("peustiue Large rum be) 3 Ase £ \ System - ak. pontls Gr cseives number"); % y alse id Cinprr 20)

You might also like