public class P_07_recursion_factorial { static int factorial(int n) { if (n == 1) return 1; else return(n * factorial(n-1)); } public static void main(String[] args) { System.out.println("Factorial of 5 is: "+factorial(5)); } } Output :
class P_06_explicit { public static void main(String[] args) { double d = 100.04; long l = (long)d; int i = (int)l; System.out.println("Double value "+d); System.out.println("Long value "+l); System.out.println("Int value "+i); } } Output
class P_06_implicit { public static void main(String[] args) { int i = 100; long l = i; float f = l; System.out.println("Int value "+i); System.out.println("Long value "+l); System.out.println("Float value "+f); } } Output
CODE : a) WHILE LOOP public class P_04_fibb_while_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); while (a<10) { temp=a+b; b=a; a=temp; System.out.println(temp); temp++; } } } b) DO WHILE LOOP public class P_04_do_fibb_while_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); do{ temp=a+b; b=a; a=temp; System.out.println(temp); temp++; }while (a<10); } } c) FOR LOOP public class P_04_fibb_for_loop { public static void main(String[] args) { int a=1,temp=0,b=0; System.out.println(a); for(;a<10;temp++) { temp=a+b; b=a; a=temp; System.out.println(temp); } } } Output :
CODE : class P_03_print_day_switch_case_part3 { public static void main(String[] args) { int a=1; switch (a) { case 0: System.out.println("Today is Monday"); break; case 1: System.out.println("Today is Tuesday"); break; case 2: System.out.println("Today is Wednesday"); break; case 3: System.out.println("Today is Thursday"); break; case 4: System.out.println("Today is Friday"); break; case 5: System.out.println("Today is Saturday"); break; case 6: System.out.println("Today is Sunday"); break; default: System.out.println("You are doomed"); } } } Output :
CODE : public class P_03_greatest_3_no_part2 { public static void main(String[] args) { int a=1,b=2,c=3; if (a>b && a>c) { System.out.println("A is greatest"); } else if (b>c && b>a) { System.out.println("B is greatest"); } else{ System.out.println("C is greatest"); } } } Output :
CODE : public class P_03_even_odd_part1 { public static void main(String[] args) { int a=5; if (a%2==0) { System.out.println("No. is Even"); } else { System.out.println("No. is Odd"); } } } Output :
CODE : public class P_02_2dArrayMultiplication{ public static void main(String[] args) { int n = 2; int[][] a = {{1,2},{4,5}}; int[][] b = {{2,1},{5,6}}; int[][] c = new int[n][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { c[i][j] = c[i][j] + a[i][k] * b[k][j]; } } } System.out.println("The product is:"); ...
Include the following source Code in Document Environment in your LaTeX File Source Code: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Practical 4 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newpage \section{\emph{To setup IIS and Apache Web Server on computer system.}} \textbf{Setup of IIS Server} \\Internet Information Services (IIS) is an extensible web server created by Microsoft for use with Windows NT family. IIS supports HTTP, HTTPS, FTP, FTPS, SMTP and NNTP. It has been an integral part of the Windows NT family since Windows NT 4.0, though it may be absent from some edition and is not active by default.\\ \textbf{Steps for Setting IIS Server} \begin{enumerate} \item To open the Windows Features dialog box, click Start, and then click Control Panel \begin{figure}[h] \centering \includegraphics[scale=0.7]{p4} \end{figure} \item In...
All The Lab Practicals will be Done in LaTeX. This is Lab File For GNDEC IT Dept. students.All the codes are written in easiest way.You can copy.Get output and enjoy! ! Point to be noted: Copy The Source code As it is......But Do Remember 😜 to change name and roll no. on front page. I have Commented{in RED with %} in the code Where you have to do Changes so enjoy with a few changes!! Practical 3 and Practical 4 only 1st page is made ,so rest get it printed from practical 3 and 4 pdfs. Download all images (Given Below)in the same folder,where you have saved the copy of source code i.e. (.tex) file TeXworks used for compiling!! HTML FILES !! TeX File !! Output at end Keep iView-ing!! Source Code: \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{wrapfig} \usepackage{multicol} \usepackage{caption} \usepackage{subcaption} \usepackage{transparent} \usepackage{multirow} \usepackage{eso-pic} \usepackage[utf8]{in...