├── Semester 5 (PIP) └── assignment1 │ ├── prog3.py │ ├── prog6.py │ ├── prog5.py │ ├── prog7.py │ ├── prog1.py │ ├── prog4.py │ └── prog2.py ├── Semester 4 (CSW-2) ├── ch5 │ ├── part7 │ │ ├── prog1.class │ │ └── prog1.java │ ├── part11 │ │ ├── prog1.java │ │ └── Rectangle.java │ ├── part8 │ │ └── prog1.java │ ├── part1 │ │ ├── prog1.java │ │ └── prog2.java │ ├── part6 │ │ └── prog1.java │ ├── part9 │ │ └── prog1.java │ ├── part2 │ │ └── prog1.java │ ├── part4 │ │ └── prog1.java │ ├── part3 │ │ └── prog1.java │ ├── part10 │ │ └── prog1.java │ └── part5 │ │ └── prog1.java ├── ch6 │ ├── part8 │ │ ├── prog2.java │ │ └── prog1.java │ ├── part16 │ │ └── prog1.java │ ├── part15 │ │ ├── test.java │ │ ├── prog2.java │ │ └── prog1.java │ ├── part10 │ │ ├── test1.java │ │ └── prog1.java │ ├── part13 │ │ └── prog1.java │ ├── part2 │ │ └── prog1.java │ ├── part4 │ │ └── prog1.java │ ├── part6 │ │ └── prog1.java │ ├── part5 │ │ └── prog1.java │ ├── part11 │ │ └── prog1.java │ ├── part9 │ │ └── prog1.java │ ├── part1 │ │ └── prog1.java │ ├── part7 │ │ └── prog1.java │ └── part12 │ │ └── prog1.java ├── ch8 │ ├── part2 │ │ ├── prog1.java │ │ └── Node.java │ ├── part1 │ │ ├── prog1.java │ │ └── Node.java │ ├── part7 │ │ ├── prog1.java │ │ └── Node.java │ ├── part10 │ │ ├── prog1.java │ │ └── Node.java │ ├── part9 │ │ ├── prog1.java │ │ └── Node.java │ ├── part11 │ │ ├── prog1.java │ │ └── Node.java │ ├── part12 │ │ ├── prog1.java │ │ └── Node.java │ ├── part3 │ │ ├── prog1.java │ │ └── Node.java │ ├── part8 │ │ ├── prog1.java │ │ └── Node.java │ ├── part6 │ │ ├── prog1.java │ │ ├── Node.java │ │ └── LinkedList.java │ ├── part4 │ │ ├── Node.java │ │ └── prog1.java │ ├── part13 │ │ ├── prog1.java │ │ └── Node.java │ ├── part5 │ │ ├── Node.java │ │ └── prog1.java │ └── prac1 │ │ └── prog1.java └── ch7 │ ├── part3 │ └── prog1.java │ ├── part4 │ └── prog1.java │ ├── part2 │ └── prog1.java │ ├── part11 │ └── prog1.java │ ├── part9 │ └── prog1.java │ ├── part1 │ └── prog1.java │ ├── part5 │ └── prog1.java │ ├── part13 │ └── prog1.java │ └── part8 │ └── prog1.java ├── Semester 2 (DSA) ├── assignment 2 │ ├── a2q9 │ │ ├── mypack2 │ │ │ └── Sports.java │ │ ├── a2q9.java │ │ └── mypack1 │ │ │ ├── Student.java │ │ │ └── Test.java │ └── a2q7.java ├── assignment 6 │ └── Node.java ├── assignment 7 │ └── Node.java ├── assignment 5 │ └── Node.java ├── minor 2 │ └── Node.java ├── assignment 4 │ └── Node.java ├── assignment 3 │ ├── a3q13.java │ ├── a3q7.java │ ├── a3q10.java │ ├── a3q15.java │ ├── a3q16.java │ ├── a3q9.java │ ├── a3q14.java │ ├── a3q8.java │ ├── a3q11.java │ ├── a3q1.java │ ├── a3q5.java │ ├── a3q2.java │ ├── a3q6.java │ ├── Student.java │ ├── a3q12.java │ └── a3q17.java └── assignment 1 │ ├── a1q2.java │ ├── a1q4.java │ ├── a1q5.java │ ├── a1q8.java │ ├── a1q7.java │ ├── a1q1.java │ ├── StudentDetails2.java │ ├── Point.java │ ├── a1q6.java │ └── StudentDetails.java ├── Semester 3 (CWS-1) ├── Assignments │ ├── Assignment 3 │ │ ├── a3q10.java │ │ ├── a3q11.java │ │ ├── a3q25.java │ │ ├── a3q26.java │ │ ├── a3q27.java │ │ ├── a3q29.java │ │ ├── a3q9.java │ │ ├── a3q3.java │ │ ├── a3q17.java │ │ ├── a3q21.java │ │ ├── a3q19.java │ │ ├── a3q4.java │ │ ├── a3q24.java │ │ ├── a3q16.java │ │ ├── a3q15.java │ │ ├── a3q5.java │ │ ├── a3q23.java │ │ ├── a3q20.java │ │ ├── a3q14.java │ │ ├── a3q7.java │ │ ├── a3q12.java │ │ ├── a3q8.java │ │ └── a3q18.java │ ├── Assignment On Regular Expression │ │ ├── prog4.java │ │ ├── prog5.java │ │ ├── prog1.java │ │ ├── prog6.java │ │ ├── prog7.java │ │ └── prog3.java │ ├── Assignment 1 │ │ ├── a1q1.java │ │ ├── mypack2 │ │ │ ├── a1q5p1.java │ │ │ └── a1q5p2.java │ │ ├── a1q2p4.java │ │ ├── mypack │ │ │ ├── a1q2p2.java │ │ │ └── a1q2p1.java │ │ ├── a1q2p3.java │ │ └── a1q3.java │ └── Assignment on Interacting with the Environment │ │ ├── prog2.java │ │ ├── prog1.java │ │ ├── prog4.java │ │ ├── prog3.java │ │ ├── prog7.java │ │ ├── prog5.java │ │ └── prog6.java └── Class Works │ ├── class 4 │ ├── classBreakQuestion │ │ ├── prog3.java │ │ ├── prog2.java │ │ ├── prog1.java │ │ └── prog4.java │ ├── prog4.java │ ├── prog6.java │ ├── prog5.java │ ├── prog1.java │ ├── prog2.java │ ├── prog3.java │ └── prog6files.java │ ├── class 1 │ ├── mypackage │ │ ├── diffclass.java │ │ ├── First.java │ │ └── Second.java │ ├── newpackage │ │ └── diffpack.java │ └── Student_main.java │ ├── class 3 │ ├── prog6.java │ ├── prog2.java │ ├── prog7.java │ ├── prog4.java │ ├── prog5.java │ └── prog3.java │ └── class 2 │ └── trial.java ├── Semester 1 (ICP) ├── assignment 4 │ ├── a4q5.java │ ├── a4q12.java │ ├── a4q8.java │ ├── a4q6.java │ ├── a4q15.java │ ├── a4q16a.java │ ├── a4q16b.java │ ├── a4q16c.java │ ├── a4q9.java │ ├── a4q16d.java │ ├── a4q3.java │ ├── a4q10.java │ ├── a4q17.java │ ├── a4q7.java │ ├── a4q4.java │ ├── a4q14.java │ ├── a4q1.java │ ├── a4q13.java │ ├── a4q11.java │ └── a4q2.java ├── assignment 1 │ ├── a1q6.java │ ├── a1q10.java │ ├── a1q5.java │ ├── a1q4.java │ ├── a1q12.java │ ├── a1q9.java │ ├── a1q11.java │ ├── a1q13.java │ ├── a1q7.java │ ├── a1q8.java │ ├── a1q1.java │ └── a1q3.java ├── assignment 2 │ ├── a2q16.java │ ├── a2q19.java │ ├── a2q21.java │ ├── a2q14.java │ ├── a2q8.java │ ├── a2q15.java │ ├── a2q22.java │ ├── a2q18.java │ ├── a2q3.java │ ├── a2q7.java │ ├── a2q1.java │ ├── a2q5.java │ ├── a2q13.java │ ├── a2q17.java │ ├── a2q2.java │ ├── a2q12.java │ ├── a2q23.java │ ├── a2q6.java │ ├── a2q9.java │ ├── a2q4.java │ ├── a2q20.java │ ├── a2q11.java │ ├── a2q24.java │ └── a2q10.java ├── assignment 3 │ ├── a3q1.java │ ├── a3q3.java │ ├── a3q2.java │ ├── a3q12.java │ ├── a3q15.java │ ├── a3q8.java │ ├── a3q4.java │ ├── a3q11.java │ ├── a3q17.java │ ├── a3q7.java │ ├── a3q6.java │ ├── a3q5.java │ ├── a3q16.java │ ├── a3q14.java │ └── a3q9.java ├── assignment 5 │ ├── hw │ │ ├── a5q14.java │ │ ├── a5q3.java │ │ ├── a5q4.java │ │ ├── a5q2.java │ │ ├── a5q5.java │ │ ├── a5q7.java │ │ ├── a5q10.java │ │ ├── a5q18.java │ │ ├── a5q9.java │ │ ├── a5q17.java │ │ ├── a5q11.java │ │ ├── a5q15.java │ │ ├── a5q16.java │ │ ├── a5q13.java │ │ ├── a5q22.java │ │ ├── a5q19.java │ │ ├── a5q6.java │ │ ├── a5q12.java │ │ ├── a5q20.java │ │ ├── a5q8.java │ │ └── a5q1.java │ └── cw │ │ ├── a5q1.java │ │ ├── a5q3.java │ │ ├── PrimeCounter.java │ │ ├── a5q8.java │ │ ├── a5q19.java │ │ ├── a5q16.java │ │ ├── a5q18.java │ │ ├── a5q20.java │ │ ├── a5q13.java │ │ ├── a5q14.java │ │ ├── a5q2.java │ │ ├── a5q7.java │ │ ├── a5q12.java │ │ ├── a5q9.java │ │ ├── a5q5.java │ │ ├── a5q17.java │ │ ├── a5q6.java │ │ ├── a5q24.java │ │ ├── a5q4.java │ │ ├── a5q21.java │ │ ├── a5q22.java │ │ ├── a5q15.java │ │ ├── a5q10.java │ │ └── a5q11.java ├── assignment 7 │ ├── a7q7.java │ ├── a7q4.java │ ├── a7q1.java │ ├── a7q3.java │ ├── a7q2.java │ ├── a7q5.java │ ├── a7q13.java │ ├── a7q11.java │ ├── a7q6.java │ └── a7q9.java ├── assignment 6 │ ├── a6q2.java │ ├── a6q4.java │ ├── a6q5.java │ ├── a6q10.java │ ├── a6q7.java │ ├── a6q8.java │ ├── a6q12.java │ ├── a6q11.java │ ├── a6q13.java │ ├── a6q3.java │ ├── a6q6.java │ ├── a6q14.java │ └── a6q9.java ├── assignment 8 │ └── cw │ │ ├── a8q4.java │ │ ├── a8q3.java │ │ ├── a8q1.java │ │ ├── a8q8.java │ │ ├── a8q2.java │ │ ├── a8q5.java │ │ ├── a8q10.java │ │ └── a8q6.java └── assignment 9 │ ├── Rectangle.java │ └── StudentDetails.java ├── CONTRIBUTING.md ├── README.md └── .github └── ISSUE_TEMPLATE └── bug_report.md /Semester 5 (PIP)/assignment1/prog3.py: -------------------------------------------------------------------------------- 1 | print(''' 2 | * 3 | * * 4 | * * * 5 | * * * * 6 | * * * * * 7 | ''') -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog6.py: -------------------------------------------------------------------------------- 1 | a=5 2 | b=10 3 | print('a =',a,'b =',b) 4 | a,b = b,a 5 | print('a =',a,'b =',b) -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog5.py: -------------------------------------------------------------------------------- 1 | a=5 2 | b=10 3 | print('a =',a,'b =',b) 4 | c=a 5 | a=b 6 | b=c 7 | print('a =',a,'b =',b) -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog7.py: -------------------------------------------------------------------------------- 1 | 2 | r='1' 3 | print(r) 4 | r+='2'+r 5 | print(r) 6 | r+='3'+r 7 | print(r) 8 | r+='4'+r 9 | print(r) -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part7/prog1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 4 (CSW-2)/ch5/part7/prog1.class -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part8/prog2.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 4 (CSW-2)/ch6/part8/prog2.java -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 2/a2q9/mypack2/Sports.java: -------------------------------------------------------------------------------- 1 | package mypack2; 2 | public interface Sports 3 | { 4 | public static final int score1=50, score2=60; 5 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part16/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part16; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 6/Node.java: -------------------------------------------------------------------------------- 1 | public class Node 2 | { 3 | int info; 4 | Node next; 5 | Node(int info) 6 | { 7 | this.info=info; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q10.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q10.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q11.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q11.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q25.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q25.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q26.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q26.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q27.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q27.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q29.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q29.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q9.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment 3/a3q9.java -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 7/Node.java: -------------------------------------------------------------------------------- 1 | public class Node 2 | { 3 | int info; 4 | Node next; 5 | Node(int info) 6 | { 7 | this.info=info; 8 | this.next=null; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q5.java: -------------------------------------------------------------------------------- 1 | class a4q5 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(double a=-2.0; a<=2.0; a=a+0.5) 6 | System.out.print(a+"\t"); 7 | } 8 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/classBreakQuestion/prog3.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Class Works/class 4/classBreakQuestion/prog3.java -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment On Regular Expression/prog4.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MartyMiniac/ITER-Assignment/HEAD/Semester 3 (CWS-1)/Assignments/Assignment On Regular Expression/prog4.java -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q6.java: -------------------------------------------------------------------------------- 1 | class a1q6 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a=113; 6 | double b=2.71828; 7 | System.out.println("This is room # "+a+"\ne is close to "+b); 8 | } 9 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part15/test.java: -------------------------------------------------------------------------------- 1 | package ch6.part15; 2 | 3 | public class test { 4 | public static void main(String args[]) { 5 | for(int i=0; i<1000; i++) { 6 | prog2.main(args); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog1.py: -------------------------------------------------------------------------------- 1 | print('Hello World!') 2 | print('Hello Again') 3 | print('I like typing this.') 4 | print('this is fun.') 5 | print('I\'d much rather you \'not\'.') 6 | print('I "said" do not touch this.') -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q10.java: -------------------------------------------------------------------------------- 1 | class a1q10 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println('b'); 6 | System.out.println('b' + 'c'); 7 | System.out.println((char) ('a' + 4)); 8 | } 9 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q12.java: -------------------------------------------------------------------------------- 1 | class a4q12 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1; a<=1024; a=a*2) 6 | { 7 | System.out.println(a+"\t+"+Math.log(a)); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 1/mypackage/diffclass.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class diffclass 4 | { 5 | public static void main(String args[]) 6 | { 7 | System.out.println("diffclass"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 1/newpackage/diffpack.java: -------------------------------------------------------------------------------- 1 | package newpackage; 2 | 3 | public class diffpack 4 | { 5 | public void show() 6 | { 7 | System.out.println("This is diffpack Class"); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q16.java: -------------------------------------------------------------------------------- 1 | class a2q16 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a,b; 6 | a=(int)(1+Math.random()*6); 7 | b=(int)(1+Math.random()*6); 8 | System.out.print(a+b); 9 | } 10 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q8.java: -------------------------------------------------------------------------------- 1 | class a4q8 2 | { 3 | public static void main(String args[]) 4 | { 5 | String s=""; 6 | for(int a=1; a<=4; a++) 7 | { 8 | s=s+a+s; 9 | System.out.println(s); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 3/prog6.java: -------------------------------------------------------------------------------- 1 | import java.io.File; 2 | 3 | public class prog6 4 | { 5 | public static void main(String args[]) 6 | { 7 | File f = new File("NUL"); 8 | System.out.println(f); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q19.java: -------------------------------------------------------------------------------- 1 | class a2q19 2 | { 3 | public static void main(String args[]) 4 | { 5 | double b,g; 6 | b=Double.parseDouble(args[0]); 7 | g=b+b*0.4+b*0.2; 8 | System.out.print("Gross Salary :"+g); 9 | } 10 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q21.java: -------------------------------------------------------------------------------- 1 | class a2q21 2 | { 3 | public static void main(String args[]) 4 | { 5 | double t,a; 6 | t=Double.parseDouble(args[0]); 7 | a=Math.sin(2*t)+Math.sin(t*3); 8 | System.out.print(a); 9 | } 10 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 1/a1q1.java: -------------------------------------------------------------------------------- 1 | //Write a java program to print hello world using eclipse IDE. 2 | public class a1q1 3 | { 4 | public static void main(String args[]) 5 | { 6 | System.out.println("Hello World"); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog4.py: -------------------------------------------------------------------------------- 1 | regno='1941012661' 2 | year=2019 3 | 4 | # print('My Regd. No is %s and I have taken admission in B. Tech. In %d.' %(regno, year)) 5 | print('My Regd. No is', regno,'and I have taken admission in B. Tech. In', year,'.' ) -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/prog4.java: -------------------------------------------------------------------------------- 1 | class prog4 2 | { 3 | public static void main(String args[]) 4 | { 5 | String s ="This is a String"; 6 | for(char ch:s.toCharArray()) 7 | { 8 | System.out.println(ch); 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q5.java: -------------------------------------------------------------------------------- 1 | 2 | public class a1q5 { 3 | public static void main(String args[]) 4 | { 5 | int regno=1941012661; 6 | int yr=2019; 7 | System.out.print("My Redf. No. is "+regno+". I have Taken admission in "+yr); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q6.java: -------------------------------------------------------------------------------- 1 | class a4q6 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1001; a<=2000; a++) 6 | { 7 | System.out.print(a+"\t"); 8 | if(a%5==0) 9 | System.out.println(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q14.java: -------------------------------------------------------------------------------- 1 | class a2q14 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a,b; 6 | a=Integer.parseInt(args[0]); 7 | b=Integer.parseInt(args[1]); 8 | System.out.print(((a%b==0)&&(b%a==0))?"True":"False"); 9 | } 10 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 3/prog2.java: -------------------------------------------------------------------------------- 1 | import java.util.Properties; 2 | 3 | public class prog2 4 | { 5 | public static void main(String args[]) 6 | { 7 | Properties jvm=System.getProperties(); 8 | jvm.list(System.out); 9 | } 10 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 3/prog7.java: -------------------------------------------------------------------------------- 1 | 2 | public class prog7 3 | { 4 | public static void main(String args[]) 5 | { 6 | String s="Rohan"; 7 | System.out.println(s.concat(" Verma")); 8 | s.concat("Verma"); 9 | System.out.println(s); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 1/mypackage/First.java: -------------------------------------------------------------------------------- 1 | package mypackage; 2 | 3 | public class First 4 | { 5 | public static void main(String args[]) 6 | { 7 | System.out.println("First"); 8 | diffclass ob = new diffclass(); 9 | ob.main(args); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q8.java: -------------------------------------------------------------------------------- 1 | class a2q8 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println("a\tb\tpow(a,b)"); 6 | for(int a=1; a<=5; a++) 7 | { 8 | System.out.println(a+"\t"+(a+1)+"\t"+(int)Math.pow(a, (a+1))); 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q15.java: -------------------------------------------------------------------------------- 1 | class a4q15 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=0; a<4; a++) 6 | { 7 | for(int b=0; b<5; b++) 8 | { 9 | System.out.print("*"); 10 | } 11 | System.out.println(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q16a.java: -------------------------------------------------------------------------------- 1 | class a4q16a 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=0; a<5; a++) 6 | { 7 | for(int b=0; b<=a; b++) 8 | { 9 | System.out.print("*"); 10 | } 11 | System.out.println(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q16b.java: -------------------------------------------------------------------------------- 1 | class a4q16b 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1; a<=5; a++) 6 | { 7 | for(int b=1; b<=a; b++) 8 | { 9 | System.out.print(b); 10 | } 11 | System.out.println(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q16c.java: -------------------------------------------------------------------------------- 1 | class a4q16c 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1; a<=5; a++) 6 | { 7 | for(int b=1; b<=a; b++) 8 | { 9 | System.out.print(a); 10 | } 11 | System.out.println(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part2/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part2; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(1, 2, 3, 4, 5); 6 | System.out.println(li); 7 | li.reverse(2, 5); 8 | System.out.println(li); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q9.java: -------------------------------------------------------------------------------- 1 | class a4q9 2 | { 3 | public static void main(String args[]) 4 | { 5 | int s=0; 6 | for(int a=1; a<=1000; a++) 7 | { 8 | if(a%3==0 || a%5==0) 9 | s=s+a; 10 | } 11 | System.out.println("Sum of multiples of 3 and 5 ="+s); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 1/mypack2/a1q5p1.java: -------------------------------------------------------------------------------- 1 | //Write program to demonstrate the use of more than one class in a single. package. 2 | 3 | package mypack2; 4 | 5 | public class a1q5p1 6 | { 7 | void log(String s) 8 | { 9 | System.out.println("LOG : "+s); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q15.java: -------------------------------------------------------------------------------- 1 | class a2q15 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a,b; 6 | a=Integer.parseInt(args[0]); 7 | b=Integer.parseInt(args[1]); 8 | int r=Math.min(a, b)+(int)(Math.random()*Math.abs(a-b)); 9 | System.out.println(r); 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q4.java: -------------------------------------------------------------------------------- 1 | class a1q4 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println(" *"); 6 | System.out.println(" ***"); 7 | System.out.println(" *****"); 8 | System.out.println(" *******"); 9 | System.out.println("*********"); 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment on Interacting with the Environment/prog2.java: -------------------------------------------------------------------------------- 1 | //Find the path separator used by your installed OS. 2 | public class prog2 3 | { 4 | public static void main(String args[]) 5 | { 6 | System.out.println("Path Separator is "+System.getProperty("path.separator")); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q12.java: -------------------------------------------------------------------------------- 1 | class a1q12 2 | { 3 | public static void main(String args[]) 4 | { 5 | double a=3.14159; 6 | System.out.println(a); 7 | System.out.println(a+1); 8 | System.out.println(8/(int) a); 9 | System.out.println(8/a); 10 | System.out.println((int) (8/a)); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q9.java: -------------------------------------------------------------------------------- 1 | class a1q9 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println(2 + "bc"); 6 | System.out.println(2 + 3 + "bc"); 7 | System.out.println((2+3) + "bc"); 8 | System.out.println("bc" + (2+3)); 9 | System.out.println("bc" + 2 + 3); 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part11/prog1.java: -------------------------------------------------------------------------------- 1 | package ch5.part11; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | Rectangle r1, r2; 6 | r1 = new Rectangle(0, 0, 5, 5); 7 | r2 = new Rectangle(3, 3, 2, 2); 8 | 9 | System.out.println(Rectangle.intersects(r1, r2)); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q16d.java: -------------------------------------------------------------------------------- 1 | class a4q16d 2 | { 3 | public static void main(String args[]) 4 | { 5 | int c=1; 6 | for(int a=1; a<=5; a++) 7 | { 8 | for(int b=1; b<=a; b++) 9 | { 10 | System.out.print(c+" "); 11 | c++; 12 | } 13 | System.out.println(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment on Interacting with the Environment/prog1.java: -------------------------------------------------------------------------------- 1 | //Find the file separator used by your installed OS 2 | public class prog1 3 | { 4 | public static void main(String args[]) 5 | { 6 | System.out.println("System File Separator is : "+System.getProperty("file.separator")); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q11.java: -------------------------------------------------------------------------------- 1 | class a1q11 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a = 2147483647; 6 | System.out.println(a); 7 | System.out.println(a+1); 8 | System.out.println(2-a); 9 | System.out.println(-2-a); 10 | System.out.println(2*a); 11 | System.out.println(4*a); 12 | } 13 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the number to count to :"); 8 | int i=in.nextInt(); 9 | for(int a=0; a<=i; a++) 10 | System.out.print(a+"\t"); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 5/Node.java: -------------------------------------------------------------------------------- 1 | public class Node 2 | { 3 | protected int regd_no; 4 | protected float mark; 5 | protected Node next; 6 | protected Node prev; 7 | Node(int regd_no, float mark, Node prev) 8 | { 9 | this.regd_no=regd_no; 10 | this.mark=mark; 11 | this.prev=prev; 12 | this.next=null; 13 | } 14 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 1/mypack2/a1q5p2.java: -------------------------------------------------------------------------------- 1 | //Write program to demonstrate the use of more than one class in a single. package. 2 | package mypack2; 3 | 4 | public class a1q5p2 5 | { 6 | public static void main(String args[]) 7 | { 8 | a1q5p1 ob = new a1q5p1(); 9 | ob.log("Hello There !!"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part1/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part1; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList l1 = new LinkedList(2, 5, 7); 6 | LinkedList l2 = new LinkedList(3, 11); 7 | 8 | LinkedList r = LinkedList.merge(l1, l2); 9 | 10 | System.out.println(r); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 2/trial.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class trial 3 | { 4 | public static void main(String args[]) 5 | { 6 | Map m = System.getenv(); 7 | for(Map.Entry s:m.entrySet()) 8 | { 9 | System.out.println(s.getKey()+"\t"+s.getValue()); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part8/prog1.java: -------------------------------------------------------------------------------- 1 | package ch5.part8; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | System.out.println(reverse(12345)); 6 | } 7 | public static long reverse(long x) { 8 | long rt = 0; 9 | while(x!=0) { 10 | rt=rt*10+x%10; 11 | x/=10; 12 | } 13 | return rt; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q22.java: -------------------------------------------------------------------------------- 1 | class a2q22 2 | { 3 | public static void main(String args[]) 4 | { 5 | double p,r,t,a; 6 | p=Double.parseDouble(args[0]); 7 | r=Double.parseDouble(args[1]); 8 | t=Double.parseDouble(args[2]); 9 | r=r/100; 10 | a=p*Math.exp(r*t); 11 | a=a/t*12; 12 | System.out.print("EMI :"+a); 13 | } 14 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 3/prog4.java: -------------------------------------------------------------------------------- 1 | public class prog4 2 | { 3 | public static void main(String args[]) 4 | { 5 | String s =System.getProperty("user.dir")+System.getProperty("file.separator")+"File1"; 6 | System.out.println("My File Seperator : "+System.getProperty("file.separator")); 7 | System.out.println(s); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Semester 5 (PIP)/assignment1/prog2.py: -------------------------------------------------------------------------------- 1 | print(''' 2 | RRRRRRRRRR V V 3 | R R V V 4 | R R V V 5 | R R V V 6 | RRRRRRRRRR V V 7 | R R V V 8 | R R V V 9 | R R V V 10 | R R V 11 | ''') -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q18.java: -------------------------------------------------------------------------------- 1 | class a2q18 2 | { 3 | public static void main(String args[]) 4 | { 5 | double a,b,c; 6 | a=Double.parseDouble(args[0]); 7 | b=Double.parseDouble(args[1]); 8 | c=Double.parseDouble(args[2]); 9 | System.out.print(((ab)?(b>c)?true:false:false)?true:false); 10 | } 11 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a2q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a value for feet : "); 8 | double f=in.nextDouble(); 9 | double m=f*0.305; 10 | System.out.println(f+" feet is "+m+" meters"); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 2/a2q9/a2q9.java: -------------------------------------------------------------------------------- 1 | package a2q9; 2 | import mypack1.*; 3 | import mypack2.*; 4 | public class a2q9 implements Sports 5 | { 6 | public static void main(String args[]) 7 | { 8 | Test ob = new Test(); 9 | ob.input(); 10 | int t=ob.mark1+ob.mark2+score1+score2; 11 | System.out.println("Grand Total ="+t); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part7/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part7; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | for(int i=0; i<10; i++) { 7 | li.add(i); 8 | } 9 | System.out.println(li); 10 | 11 | li.deleteFromLast(2); 12 | 13 | System.out.println(li); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the side : "); 8 | double s=in.nextDouble(); 9 | double a=3*Math.sqrt(3)*s*s*0.5; 10 | System.out.print("The area of the hexagon is "+a); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a3q1 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Height of the person :"); 8 | double h=in.nextDouble(); 9 | if(h>=6) 10 | { 11 | System.out.print("Person is tall "); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q14.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q14 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Number :"); 8 | int n=in.nextInt(); 9 | String s=Integer.toString(n); 10 | System.out.println("No of digits ="+s.length()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 7/a7q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a7q7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the decimal number :"); 8 | String s=Integer.toOctalString(in.nextInt()); 9 | System.out.println("Octal Value of the entered number is "+s); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q1 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter temperature in degree Celsius : "); 8 | double c=in.nextDouble(); 9 | double f=(9/5.0)*c+32; 10 | System.out.print(c+" Celsius is "+f+" Fahrenheit"); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a number :"); 8 | int n=in.nextInt(); 9 | if(n%2==0) 10 | System.out.print(n+" is even"); 11 | else 12 | System.out.print(n+" is odd"); 13 | } 14 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q1 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("Enter a Number :"); 8 | int n=in.nextInt(); 9 | for(int a=0; a<=n; a++) 10 | { 11 | System.out.println(a+"\t"+(int)Math.pow(2,a)); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of n :"); 8 | int n=in.nextInt(); 9 | for(int a=0; a<=n; a++) 10 | { 11 | System.out.print((int)Math.pow(2,a)+"\t"); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q2.java: -------------------------------------------------------------------------------- 1 | class a6q2 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1; a<=100; a++) 6 | { 7 | System.out.print(getPentagonalNumber(a)+"\t"); 8 | if(a%10==0) 9 | System.out.println(); 10 | } 11 | } 12 | public static int getPentagonalNumber(int n) 13 | { 14 | return n*(3*n-1)/2; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/minor 2/Node.java: -------------------------------------------------------------------------------- 1 | public class Node 2 | { 3 | protected int exp, coeff; 4 | protected Node next; 5 | Node(int coeff, int exp) 6 | { 7 | this.coeff=coeff; 8 | this.exp=exp; 9 | this.next=null; 10 | } 11 | public int getExp() 12 | { 13 | return this.exp; 14 | } 15 | public int getCoeff() 16 | { 17 | return this.coeff; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part10/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part10; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | 7 | for(int i=0; i<10; i++) { 8 | li.add(i); 9 | } 10 | 11 | System.out.println(li); 12 | 13 | li.evenOddMerge(); 14 | 15 | System.out.println(li); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part9/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part9; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | 7 | for(int i=0; i<10; i++) { 8 | li.add(i); 9 | } 10 | 11 | System.out.println(li); 12 | 13 | li.cyclicRightShift(3); 14 | 15 | System.out.println(li); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | While Contributing to the project you are required to first create an issue that you want to resolve. 2 | Then you should fork my repo and update the files. 3 | Once you are done with that you can send a pull request. 4 | You should update the issue explaining how you have tackled the problem. 5 | If it is convincing enough then your pull request will be accepted. 6 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q3.java: -------------------------------------------------------------------------------- 1 | class a5q3 2 | { 3 | public static void main(String args[]) 4 | { 5 | int c=0; 6 | for(int a=100; a<=1000; a++) 7 | { 8 | if(a%5==0 && a%6==0) 9 | { 10 | System.out.print(a+" "); 11 | c++; 12 | } 13 | if(c==10) 14 | { 15 | c=0; 16 | System.out.println(); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q13.java: -------------------------------------------------------------------------------- 1 | class a1q13 2 | { 3 | public static void main(String args[]) 4 | { 5 | String ruler1="1"; 6 | System.out.println(ruler1); 7 | ruler1=ruler1+"2"+ruler1; 8 | System.out.println(ruler1); 9 | ruler1=ruler1+"3"+ruler1; 10 | System.out.println(ruler1); 11 | ruler1=ruler1+"4"+ruler1; 12 | System.out.println(ruler1); 13 | } 14 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q4.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | int t=1; 10 | for(int a=1; a<=n; a++) 11 | { 12 | System.out.print(t+"\t"); 13 | t=t*-1; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 3/prog5.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class prog5 3 | { 4 | public static void main(String args[]) 5 | { 6 | Properties p =System.getProperties(); 7 | System.out.println("Path Separator using Object = "+p.getProperty("path.separator")); 8 | System.out.println("Path Separator = "+System.getProperty("path.separator")); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/PrimeCounter.java: -------------------------------------------------------------------------------- 1 | class PrimeCounter 2 | { 3 | public static void main(String args[]) 4 | { 5 | int n=Integer.parseInt(args[0]); 6 | for(int a=2; a<=n; a++) 7 | { 8 | int no=1,c=0; 9 | while(no<=a) 10 | { 11 | if(a%no==0) 12 | c++; 13 | no++; 14 | } 15 | if(c==2) 16 | System.out.println(a); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | long f=1l; 10 | for(int a=1; a<=n; a++) 11 | { 12 | f=f*a; 13 | } 14 | System.out.println(n+"! ="+f); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q2 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | int s=0; 10 | for(int a=1; a<=n; a++) 11 | { 12 | s=s+a*a; 13 | } 14 | System.out.println("Sum ="+s); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part1/prog1.java: -------------------------------------------------------------------------------- 1 | //count the number of bits 2 | package ch5.part1; 3 | 4 | public class prog1 { 5 | public static void main(String args[]) { 6 | System.out.println(countBits(0b101)); 7 | } 8 | public static int countBits(int num) { 9 | int count=0; 10 | while(num!=0) { 11 | count++; 12 | num&=(num-1); 13 | } 14 | return count; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part1/prog2.java: -------------------------------------------------------------------------------- 1 | //calculate the parity 2 | package ch5.part1; 3 | 4 | public class prog2 { 5 | public static void main(String args[]) { 6 | System.out.println(getParity(0b11)); 7 | } 8 | public static int getParity(int num) { 9 | int result=0; 10 | while(num!=0) { 11 | result^=1; 12 | num&=(num-1); 13 | } 14 | return result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a2q5 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter v0, v1 and t : "); 8 | double v0=in.nextDouble(),v1=in.nextDouble(),t=in.nextDouble(); 9 | double a=(v1-v0)/t; 10 | System.out.print("The average accelaration is "+a); 11 | } 12 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q19.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q19 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a number :"); 8 | int n=in.nextInt(); 9 | String s=""; 10 | while(n>0) 11 | { 12 | int t=n%2; 13 | n/=2; 14 | s=t+s; 15 | } 16 | System.out.println(s); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part6/prog1.java: -------------------------------------------------------------------------------- 1 | package ch5.part6; 2 | 3 | public class prog1 { 4 | public static void main(String[] args) { 5 | int x=27,y=3,res=0;; 6 | int k=4; 7 | int y2k=y<<4; 8 | while(x>=y) { 9 | while(y2k>x) { 10 | y2k>>=1; 11 | k--; 12 | } 13 | res+=1<0) 11 | { 12 | f=f*10+n%10; 13 | n=n/10; 14 | } 15 | System.out.println("Reversed Number : "+f); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment On Regular Expression/prog5.java: -------------------------------------------------------------------------------- 1 | //Write a program to demonstrate the working of splitting a text by a given pattern. 2 | public class prog5 3 | { 4 | public static void main(String args[]) 5 | { 6 | String s="CSE1ECE2EEE3CIVIL"; 7 | String arr[] = s.split("\\d"); 8 | for(String t :arr) 9 | { 10 | System.out.println(t); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part11/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part11; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | 7 | for(int i=1; i<6; i++) { 8 | li.add(i); 9 | } 10 | for(int i=5; i>0; i--) { 11 | li.add(i); 12 | } 13 | System.out.println(li); 14 | 15 | System.out.println(li.checkPalindrome()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q7.java: -------------------------------------------------------------------------------- 1 | class a1q7 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a=10, b=20; 6 | System.out.println("Value of a = "+a); 7 | System.out.println("Value of b = "+b); 8 | System.out.println("Values Exchanging"); 9 | int c=a; 10 | a=b; 11 | b=c; 12 | System.out.println("Value of a = "+a); 13 | System.out.println("Value of b = "+b); 14 | } 15 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q8.java: -------------------------------------------------------------------------------- 1 | class a1q8 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a=10, b=20; 6 | System.out.println("Value of a = "+a); 7 | System.out.println("Value of b = "+b); 8 | System.out.println("Values Exchanging"); 9 | a=a+b; 10 | b=a-b; 11 | a=a-b; 12 | System.out.println("Value of a = "+a); 13 | System.out.println("Value of b = "+b); 14 | } 15 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q10.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q10 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a no. fow which you want to find the multiplication table :"); 8 | int i=in.nextInt(); 9 | for(int a=1; a<=10; a++) 10 | { 11 | System.out.println(i+"x"+a+"="+(i*a)); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q5.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q5 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | double n=in.nextInt(); 9 | int f=1; 10 | for(int a=1; a<=n; a++) 11 | { 12 | f=f*a; 13 | } 14 | n=1.0/f; 15 | System.out.println("1/n! ="+n); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q4.java: -------------------------------------------------------------------------------- 1 | class a6q4 2 | { 3 | public static void main(String args[]) 4 | { 5 | int s=0; 6 | for(int a=2000; a<=2020; a++) 7 | s=s+numberOfDaysInAYear(a); 8 | System.out.println(s); 9 | } 10 | public static int numberOfDaysInAYear(int year) 11 | { 12 | if((year%4==0 || year%100==0) && year%400!=0) 13 | return 366; 14 | else 15 | return 365; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter Mins :"); 8 | long m, d, y; 9 | m=in.nextLong(); 10 | d=m/60; 11 | d=d/24; 12 | y=d/365; 13 | d=d%365; 14 | System.out.println(m+" minutes is approximately "+y+" years and "+d+" days"); 15 | } 16 | } -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 4/Node.java: -------------------------------------------------------------------------------- 1 | 2 | public class Node 3 | { 4 | protected int regd_no; 5 | protected float mark; 6 | protected Node next; 7 | Node(int regd_no, float mark) 8 | { 9 | this.regd_no=regd_no; 10 | this.mark=mark; 11 | this.next=null; 12 | } 13 | public float getMarks() 14 | { 15 | return mark; 16 | } 17 | public int getRegd_no() 18 | { 19 | return regd_no; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 1/mypackage/Second.java: -------------------------------------------------------------------------------- 1 | //Write a Program to demonstrate the use of more than one classes in separate packages. 2 | 3 | package mypackage; 4 | 5 | import newpackage.diffpack; 6 | 7 | public class Second 8 | { 9 | public static void main(String args[]) 10 | { 11 | System.out.println("This is Second Class"); 12 | diffpack ob = new diffpack(); 13 | ob.show(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part12/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part12; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | 7 | li.add(3); 8 | li.add(2); 9 | li.add(2); 10 | li.add(11); 11 | li.add(7); 12 | li.add(5); 13 | li.add(11); 14 | 15 | System.out.println(li); 16 | 17 | li.piviot(7); 18 | 19 | System.out.println(li); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ITER Assignment 2 | It Contains all the Acadamic Assignments and Projects realting to Computer and Programing that we recieve throughout the Year in ITER College
3 | As of now this project contains all the assignments till `2nd year 4th Semester`. 4 |

5 | ITER or a *Institue to Technical Eduation and Research* is a part of *Siksha 'O' Anusandhan (Deemed to be University)* situated in Bhubaneshwar, Odisha, India. 6 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q17.java: -------------------------------------------------------------------------------- 1 | class a4q17 2 | { 3 | public static void main(String args[]) 4 | { 5 | for(int a=1; a<=10; a++) 6 | { 7 | for(int b=1;b<=10; b++) 8 | { 9 | if(a%b==0 || b%a==0) 10 | { 11 | System.out.print("* "); 12 | } 13 | else 14 | { 15 | System.out.print(" "); 16 | } 17 | } 18 | System.out.print(a); 19 | System.out.println(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a Number :"); 8 | int n=in.nextInt(); 9 | int f=1,a=1; 10 | boolean k=false; 11 | while(f<=n) 12 | { 13 | a++; 14 | f*=a; 15 | } 16 | f/=a; 17 | System.out.println("Largest possible factorial ="+f); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part9/prog1.java: -------------------------------------------------------------------------------- 1 | package ch5.part9; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | System.out.println(checkPalindrome(-12321)); 6 | } 7 | public static long reverse(long x) { 8 | long rt = 0; 9 | while(x!=0) { 10 | rt=rt*10+x%10; 11 | x/=10; 12 | } 13 | return rt; 14 | } 15 | public static boolean checkPalindrome(long x) { 16 | return x==reverse(x); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q17.java: -------------------------------------------------------------------------------- 1 | class a2q17 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a,b,c; 6 | a=Integer.parseInt(args[0]); 7 | b=Integer.parseInt(args[1]); 8 | c=Integer.parseInt(args[2]); 9 | if(a>(b+c)) 10 | System.out.print(true); 11 | else if(b>(a+c)) 12 | System.out.print(true); 13 | else if(c>(a+b)) 14 | System.out.print(true); 15 | else 16 | System.out.print(false); 17 | } 18 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q2 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the marks in your Exam :"); 8 | double m=in.nextDouble(); 9 | if(m>=40) 10 | { 11 | System.out.print("Congratulation! you passed the Exam"); 12 | } 13 | else 14 | System.out.print("Sorry, You Failed the Exam"); 15 | } 16 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q18.java: -------------------------------------------------------------------------------- 1 | public class a5q18 2 | { 3 | public static void main(String args[]) 4 | { 5 | double c = Double.parseDouble(args[0]); 6 | double e = 1e-10; 7 | double t = c; 8 | double k = Double.parseDouble(args[1]); 9 | while (Math.abs(t - c/t) > e*t) 10 | { 11 | t = (c/t + t) / k; 12 | } 13 | System.out.println(t); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q2 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the radius :" ); 8 | double r,l,a,v; 9 | r=in.nextDouble(); 10 | System.out.print("Enter the length :" ); 11 | l=in.nextDouble(); 12 | a=r*r*Math.PI; 13 | v=a*l; 14 | System.out.println("The area is "+a+"\nThe Volume is "+v); 15 | } 16 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q20.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q20 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a Number :"); 8 | int n=in.nextInt(); 9 | int f=2; 10 | while(n>1) 11 | { 12 | if(n%f==0) 13 | { 14 | System.out.print(f+", "); 15 | n/=f; 16 | } 17 | else 18 | { 19 | f++; 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q10.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q10 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of n :"); 8 | int n=in.nextInt(); 9 | int a=2,b=1; 10 | System.out.print(a+"\t"+b); 11 | for(int i=2; i<=n; i++) 12 | { 13 | int t=b; 14 | b=a+b; 15 | a=t; 16 | System.out.print("\t"+b); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q18.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q18 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n =in.nextInt(); 9 | System.out.println("Perfect Divisiors of "+n+" are"); 10 | for(int a=1; a<=n; a++) 11 | { 12 | if(n%a==0) 13 | { 14 | System.out.println(a); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q5.java: -------------------------------------------------------------------------------- 1 | class a6q5 2 | { 3 | public static void main(String args[]) 4 | { 5 | a6q5 ob = new a6q5(); 6 | for(int a=2; a<=10000; a++) 7 | { 8 | if(ob.isPrime(a)) 9 | System.out.println(a); 10 | } 11 | } 12 | public boolean isPrime(int number) 13 | { 14 | int c=0; 15 | for(int a=2; a<=Math.sqrt(number); a++) 16 | { 17 | if(number%a==0) 18 | c++; 19 | } 20 | return c==0; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part3/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part3; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList l = new LinkedList(); 6 | l.add(1); 7 | l.add(2); 8 | l.add(3); 9 | l.add(4); 10 | //l.add(5); 11 | 12 | System.out.println(l.hasCycle()); 13 | 14 | //Making the LinkedList Cyclic 15 | l.add(l.getHead()); 16 | 17 | 18 | System.out.println(l.hasCycle()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | long t1=0l,t2=1l; 10 | System.out.println(t1); 11 | for(int a=1; a<=n; a++) 12 | { 13 | long t=t2; 14 | t2=t1+t2; 15 | t1=t; 16 | System.out.println(t1); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q14.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q14 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | long t1=0l,t2=1l; 10 | System.out.println(t1); 11 | for(int a=1; a<=n; a++) 12 | { 13 | long t=t2; 14 | t2=t1+t2; 15 | t1=t; 16 | System.out.println(t1); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q12.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q12 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | int inp, g, d, l; 8 | System.out.print("Enter the number of eggs :"); 9 | inp=in.nextInt(); 10 | g=inp/144; 11 | inp=inp%144; 12 | d=inp/12; 13 | inp=inp%12; 14 | l=inp; 15 | System.out.print("Your number of eggs are "+g+" gross, "+d+" dozen, and "+l+"."); 16 | } 17 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q23.java: -------------------------------------------------------------------------------- 1 | class a2q23 2 | { 3 | public static void main(String args[]) 4 | { 5 | int a,b,c,s; 6 | a=Integer.parseInt(args[0]); 7 | b=Integer.parseInt(args[1]); 8 | c=Integer.parseInt(args[2]); 9 | s=a+b+c; 10 | s=s-Math.max(Math.max(a, b), Math.max(b, c))-Math.min(Math.min(a, b), Math.min(b, c)); 11 | System.out.print(Math.max(Math.max(a, b), Math.max(b, c))+">"+s+">"+Math.min(Math.min(a, b),Math.min(b,c))); 12 | } 13 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of N :"); 8 | int n=in.nextInt(); 9 | double s=0; 10 | for(int a=0; a=40) 15 | c++; 16 | } 17 | System.out.print(c+" has passed the Exam"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q7.java: -------------------------------------------------------------------------------- 1 | class a6q7 2 | { 3 | public static void main(String args[]) 4 | { 5 | a6q7 ob = new a6q7(); 6 | for(int a=2; a<=1000; a++) 7 | { 8 | if(ob.isPrime(a) && ob.isPrime(a+2)) 9 | { 10 | System.out.println("("+a+","+(a+2)+")"); 11 | } 12 | } 13 | } 14 | public boolean isPrime(int n) 15 | { 16 | int c=0; 17 | for(int a=2; a<=Math.sqrt(n); a++) 18 | { 19 | if(n%a==0) 20 | c++; 21 | } 22 | return c==0; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value of n :"); 8 | int n=in.nextInt(); 9 | int s=0; 10 | for(int a=1; a<=n ; a++) 11 | { 12 | int t=2*a-1; 13 | if(a%2==0) 14 | { 15 | s=s-t; 16 | } 17 | else 18 | { 19 | s=s+t; 20 | } 21 | } 22 | System.out.println("Sum ="+s); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part1/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part1; 2 | 3 | class Node { 4 | private int value; 5 | private Node next; 6 | 7 | public Node() { 8 | value=0; 9 | this.next=null; 10 | } 11 | 12 | public void setValue(int i) { 13 | this.value=i; 14 | } 15 | 16 | public int getValue() { 17 | return this.value; 18 | } 19 | 20 | public void setNext(Node next) { 21 | this.next=next; 22 | } 23 | 24 | public Node getNext() { 25 | return this.next; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part6/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part6; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList li = new LinkedList(); 6 | for(int i=0; i<10; i++) { 7 | li.add(i); 8 | } 9 | System.out.println(li); 10 | 11 | Node toDelete = li.getHead(); 12 | for(int i=0; i>i)&1) == ((num>>j)&1)) { 13 | return num; 14 | } 15 | int bitmask=(1<>i)&1) != ((num>>(i+1))&1)) { 13 | num ^= (1< e*t) 12 | { 13 | t = (c/t + t) / 2.0; 14 | } 15 | System.out.println(t); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q6 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Number of numbers :"); 8 | int n=in.nextInt(); 9 | double s=0; 10 | for(int a=1; a<=n; a++) 11 | { 12 | System.out.print("Enter the Term Number "+a+" : "); 13 | double t=in.nextDouble(); 14 | s=s+(1/t); 15 | } 16 | s=1/s; 17 | s=s*n; 18 | System.out.println("Harmoric Mean :"+s); 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q16.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class a3q16 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a String :"); 8 | String s=in.nextLine(); 9 | boolean ans=pal(s); 10 | System.out.println(ans); 11 | } 12 | public static boolean pal(String s) 13 | { 14 | if(s.length()<=1) 15 | return true; 16 | else 17 | return s.charAt(s.length()-1)==s.charAt(0)&&pal(s.substring(1,s.length()-1)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q14.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q14 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of n :"); 8 | int n=in.nextInt(); 9 | double o=0, a=-1; 10 | while(true) 11 | { 12 | o=a; 13 | a++; 14 | if(Math.pow(2,a)>n) 15 | break; 16 | if(Math.pow(2,a)==n) 17 | { 18 | o=a; 19 | break; 20 | } 21 | } 22 | o=Math.pow(2,o); 23 | System.out.println("Answer = "+o); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q24.java: -------------------------------------------------------------------------------- 1 | class a5q24 2 | { 3 | public static void main(String args[]) 4 | { 5 | int n=Integer.parseInt(args[0]); 6 | for(int a=0;a<=n; a++) 7 | { 8 | for(int b=0; b<=a; b++) 9 | { 10 | for(int c=0; c<=(a*a*a+b*b*b);c++) 11 | { 12 | for(int d=0; d<=(a*a*a+b*b*b); d++) 13 | { 14 | if((a*a*a+b*b*b)==(c*c*c*+d*d*d)) 15 | { 16 | System.out.println("a= "+a+" b= "+b+" c= "+c+" d= "+d); 17 | } 18 | } 19 | } 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a2q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a Number between 0 and 1000 : "); 8 | int a=in.nextInt(); 9 | int b=a,s=0; 10 | if(a<1000) 11 | { 12 | while(b>0) 13 | { 14 | s=s+b%10; 15 | b=b/10; 16 | } 17 | System.out.print("The sum of the digits is "+s); 18 | } 19 | else 20 | { 21 | System.out.println(a+" is more than 1000"); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of n :"); 8 | int n=in.nextInt(); 9 | for(int a=0; a<=n; a++) 10 | { 11 | 12 | int f=1,s=0; 13 | for(int b=1; b<=a; b++) 14 | { 15 | f=f*b; 16 | } 17 | s=s+f; 18 | for(int b=1; b<=(a+1); b++) 19 | { 20 | f=f*b; 21 | } 22 | s=s+f; 23 | System.out.println(s); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a6q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the number of sides : "); 8 | int n=in.nextInt(); 9 | System.out.print("Enter the side : "); 10 | double s=in.nextDouble(); 11 | System.out.println("The are of the polygon is "+area(n,s)); 12 | } 13 | public static double area(int n, double side) 14 | { 15 | return (n*side*side)/(4*Math.tan(Math.PI/(double)n)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q4.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | double s=0,c=0; 8 | while(true) 9 | { 10 | System.out.print("Enter an integer, the input ends if it 0 : "); 11 | int t=in.nextInt(); 12 | s=s+t; 13 | c++; 14 | if(t==0) 15 | { 16 | c--; 17 | break; 18 | } 19 | } 20 | System.out.println("The total is "+s); 21 | s=s/c; 22 | System.out.println("The average is "+s); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 2/a2q9/mypack1/Test.java: -------------------------------------------------------------------------------- 1 | package mypack1; 2 | import java.util.*; 3 | public class Test extends Student 4 | { 5 | public int mark1, mark2; 6 | public void input() 7 | { 8 | Scanner in = new Scanner(System.in); 9 | super.input(); 10 | System.out.print("Enter the Mark 1 :"); 11 | mark1=in.nextInt(); 12 | System.out.print("Enter the Mark 2 :"); 13 | mark2=in.nextInt(); 14 | } 15 | public void output() 16 | { 17 | System.out.print("Mark 1 :"+mark1); 18 | System.out.print("Mark 2 :"+mark2); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q21.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q21 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the First Number :"); 8 | int n1=in.nextInt(); 9 | System.out.print("Enter the Second Number :"); 10 | int n2=in.nextInt(); 11 | int f=1,t=1; 12 | while(t<=Math.min(n1,n2)) 13 | { 14 | if(n1%t==0 && n2%t==0) 15 | { 16 | f=t; 17 | } 18 | t++; 19 | } 20 | System.out.println("GCD of "+n1+" and "+n2+" is "+f); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q22.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q22 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a number :"); 8 | int n=in.nextInt(); 9 | int c=0,a=1; 10 | while(n>=a) 11 | { 12 | if(n%a==0) 13 | { 14 | c++; 15 | } 16 | a++; 17 | } 18 | if(c==2) 19 | { 20 | System.out.println(n+" is a Prime Number "); 21 | } 22 | else 23 | { 24 | System.out.println(n+" is a Non Prime Number "); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q22.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.math.*; 3 | class a5q22 4 | { 5 | public static void main(String args[]) 6 | { 7 | Scanner in = new Scanner(System.in); 8 | System.out.print("Enter the value of n :"); 9 | String nt=in.nextLine(); 10 | System.out.print("Enter the value of x :"); 11 | int x=in.nextInt(); 12 | BigInteger n = new BigInteger(nt); 13 | for(int a=1; a>=1; 18 | } 19 | System.out.println(c); 20 | return res; 21 | } 22 | public static void main(String[] args) { 23 | System.out.printf("Required Ans %.2f",power(2,37)); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part3/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part3; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | Node(int data) { 7 | this.data=data; 8 | this.next=null; 9 | } 10 | 11 | public void setData(int data) { 12 | this.data=data; 13 | } 14 | public int getData() { 15 | return this.data; 16 | } 17 | 18 | public void setNext(Node next) { 19 | this.next=next; 20 | } 21 | public Node getNext() { 22 | return this.next; 23 | } 24 | 25 | public String toString() { 26 | return Integer.toString(this.data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part4/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part4; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | Node(int data) { 7 | this.data=data; 8 | this.next=null; 9 | } 10 | 11 | public void setData(int data) { 12 | this.data=data; 13 | } 14 | public int getData() { 15 | return this.data; 16 | } 17 | 18 | public void setNext(Node next) { 19 | this.next=next; 20 | } 21 | public Node getNext() { 22 | return this.next; 23 | } 24 | 25 | public String toString() { 26 | return Integer.toString(this.data); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q1 3 | { 4 | public static void main(String arsg[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a String :"); 8 | String str=in.nextLine(); 9 | for(int a=1; a<=10; a++) 10 | { 11 | System.out.print(a); 12 | if(a==1) 13 | System.out.print("st "); 14 | else if(a==2) 15 | System.out.print("nd "); 16 | else if(a==3) 17 | System.out.print("rd "); 18 | else 19 | System.out.print("th "); 20 | System.out.println(str); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a number :"); 8 | int i=in.nextInt(); 9 | System.out.println("Digits of the number are :"); 10 | int a=i,s=0; 11 | while(a>0) 12 | { 13 | int t=a%10; 14 | System.out.println(t); 15 | a=a/10; 16 | s=s+t; 17 | } 18 | if(s%9==0) 19 | System.out.print(i+" is divisible by 9"); 20 | else 21 | System.out.print(i+" is not divisible by 9"); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q15.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a3q15 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter X : "); 8 | double x=in.nextDouble(); 9 | System.out.print("Enter Y : "); 10 | double y=in.nextDouble(); 11 | double c=x*x+y*y-100; 12 | if(c<0) 13 | System.out.print("("+x+","+y+") is inside the circle"); 14 | else if(c==0) 15 | System.out.print("("+x+","+y+") is on the circle"); 16 | else 17 | System.out.print("("+x+","+y+") is outside the circle"); 18 | } 19 | } -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q14.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class a3q14 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the first number :"); 8 | int a=in.nextInt(); 9 | System.out.print("Enter the second number :"); 10 | int b=in.nextInt(); 11 | int ans=mul(a,b); 12 | System.out.println(ans); 13 | } 14 | public static int mul(int a, int b) 15 | { 16 | if(b>0) 17 | return a+mul(a,b-1); 18 | else if(b<0) 19 | return mul(a,b+1)-a; 20 | else 21 | return 0; 22 | } 23 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment on Interacting with the Environment/prog7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class prog7 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter your Username : "); 8 | String userinput=in.nextLine(); 9 | in.close(); 10 | String username=System.getProperty("user.name"); 11 | if(username.equals(userinput)) 12 | { 13 | System.out.print("Correct Username"); 14 | } 15 | else 16 | { 17 | System.out.println("Incorrect Username"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q20.java: -------------------------------------------------------------------------------- 1 | class a2q20 2 | { 3 | public static void main(String args[]) 4 | { 5 | double d,m; 6 | d=Double.parseDouble(args[0]); 7 | m=Double.parseDouble(args[1]); 8 | if(m==3) 9 | { 10 | if(d>20) 11 | System.out.print(true); 12 | else 13 | System.out.print(false); 14 | } 15 | else if(m>3 && m<6) 16 | { 17 | System.out.print(true); 18 | } 19 | else if(m==6) 20 | { 21 | if(d<20) 22 | System.out.print(true); 23 | else 24 | System.out.print(false); 25 | } 26 | else 27 | System.out.print(false);; 28 | } 29 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("Enter age of Rahul, Ayush, Ajay"); 8 | double rh=in.nextDouble(); 9 | double ay=in.nextDouble(); 10 | double aj=in.nextDouble(); 11 | double m=Math.max(Math.max(rh, ay), Math.max(ay, aj)); 12 | if(m==rh) 13 | System.out.print("Rahul is Eldest"); 14 | if(m==ay) 15 | System.out.print("Ayush is Eldest"); 16 | if(m==aj) 17 | System.out.print("Ajay is Eldest"); 18 | } 19 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 1/mypack/a1q2p2.java: -------------------------------------------------------------------------------- 1 | //Write program to demonstrate the use of class, public, private, static key word of java. 2 | package mypack; 3 | 4 | public class a1q2p2 5 | { 6 | public static void main(String args[]) 7 | { 8 | //same package different class 9 | a1q2p1 ob = new a1q2p1(); 10 | System.out.println(ob.public_Value); 11 | 12 | //This one is not accessible 13 | //System.out.println(ob.private_Value); 14 | 15 | //Accessible 16 | System.out.println(ob.protected_Value); 17 | System.out.println(ob.default_Value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a Charecter:"); 8 | char ch=in.nextLine().charAt(0); 9 | int a=(int)ch; 10 | if(65<=ch && 90>=ch) 11 | System.out.print(ch+" is Capital Letter"); 12 | else if(97<=a && 122>=a) 13 | System.out.print(ch+" is Small Letter"); 14 | else if(48<=a && 57>=a) 15 | System.out.print(ch+" is a Numeral"); 16 | else 17 | System.out.print(ch+" is a Special Character"); 18 | } 19 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q19.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q19 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the First Number :"); 8 | int a=in.nextInt(); 9 | System.out.print("Enter the Second Number :"); 10 | int b=in.nextInt(); 11 | int ans=0; 12 | if (a==0) 13 | ans=b; 14 | while (b!=0) 15 | { 16 | if (a>b) 17 | a=a-b; 18 | else 19 | b=b-a; 20 | ans=a; 21 | } 22 | System.out.println(ans); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class a3q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("We will be Calculating a^n"); 8 | System.out.print("Enter the value of a :"); 9 | int a=in.nextInt(); 10 | System.out.print("Enter the value of n :"); 11 | int n=in.nextInt(); 12 | int p=pow(a,n); 13 | System.out.print("Answer = "+p); 14 | } 15 | public static int pow(int a, int n) 16 | { 17 | if(n<=1) 18 | return a; 19 | else 20 | return a*pow(a,n-1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part2/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part2; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | System.out.println(convert(32, 16)); 6 | } 7 | private static String convert(int num, int base) { 8 | StringBuffer rt = new StringBuffer(); 9 | while(num!=0) { 10 | rt.append(getValue(num%base)); 11 | num/=base; 12 | } 13 | return rt.reverse().toString(); 14 | } 15 | private static char getValue(int num) { 16 | if(num<10) { 17 | return (char)('0'+num); 18 | } 19 | else { 20 | return (char)('A'+num-10); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 2/a2q11.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a2q11 3 | { 4 | public static void main(String args[]) 5 | { 6 | double ia, air, av,mir; 7 | int noy; 8 | Scanner in = new Scanner(System.in); 9 | System.out.print("Enter investment amount :"); 10 | ia=in.nextDouble(); 11 | System.out.print("Enter annual interest rate in percentage :"); 12 | air=in.nextDouble(); 13 | System.out.print("Enter number of years :"); 14 | noy=in.nextInt(); 15 | mir=air/1200.0; 16 | av=ia*Math.pow((mir+1),noy*12); 17 | System.out.println("Accumulated value is $"+av); 18 | } 19 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment On Regular Expression/prog1.java: -------------------------------------------------------------------------------- 1 | //Write a program in Java to remove whitespaces from a string. 2 | import java.util.*; 3 | import java.util.regex.*; 4 | public class prog1 5 | { 6 | public static void main(String args[]) 7 | { 8 | Scanner in = new Scanner(System.in); 9 | System.out.print("Enter a String : "); 10 | String s=in.nextLine(); 11 | in.close(); 12 | Pattern p = Pattern.compile("\\b\\w+\\b"); 13 | Matcher m = p.matcher(s); 14 | while(m.find()) 15 | { 16 | System.out.print(s.substring(m.start(),m.end())); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part13/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part13; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList l1 = new LinkedList(); 6 | LinkedList l2 = new LinkedList(); 7 | LinkedList sum = new LinkedList(); 8 | 9 | l1.add(3); 10 | l1.add(1); 11 | l1.add(4); 12 | 13 | l2.add(7); 14 | l2.add(0); 15 | l2.add(9); 16 | l2.add(9); 17 | 18 | System.out.print(l1); 19 | System.out.print("+"); 20 | System.out.print(l2); 21 | System.out.print("="); 22 | 23 | sum.add(l1,l2); 24 | 25 | System.out.println(sum); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q11 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter Weight : "); 8 | double w=in.nextDouble(); 9 | System.out.print("Enter height : "); 10 | double h=in.nextDouble(); 11 | double bmi=w/(h*h); 12 | if(bmi<18.5) 13 | System.out.print("Underweight"); 14 | else if(bmi<24.9) 15 | System.out.print("Normal Weight"); 16 | else if(bmi<29.9) 17 | System.out.print("Overweight"); 18 | else 19 | System.out.print("Obese"); 20 | } 21 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q17.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a3q17 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter an Integer : "); 8 | int n=in.nextInt(); 9 | boolean k1=false,k2=false; 10 | if((n%5==0)&&(n%6==0)) 11 | k1=true; 12 | if((n%5==0)||(n%6==0)) 13 | k2=true; 14 | System.out.println("Is "+n+" divisible by 5 and 6? "+k1); 15 | System.out.println("Is "+n+" divisible by 5 or 6? "+k2); 16 | System.out.println("Is "+n+" divisible by 5 or 6 but not both? "+((k1==false)&&(k2==true))); 17 | } 18 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment on Interacting with the Environment/prog5.java: -------------------------------------------------------------------------------- 1 | /*Write a program which read a path to a file as a string and modify the 2 | string according to system specify file seperator and display it.*/ 3 | import java.util.*; 4 | 5 | public class prog5 6 | { 7 | public static void main(String args[]) 8 | { 9 | Scanner in = new Scanner(System.in); 10 | System.out.print("Enter a File Path : "); 11 | String path=in.nextLine(); 12 | in.close(); 13 | path=path.replace('/', System.getProperty("file.separator").charAt(0)); 14 | System.out.println(path); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q6 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a Number :"); 8 | int n=in.nextInt(); 9 | int f=1,a=1; 10 | boolean k=false; 11 | while(f0 && y>0) 11 | System.out.print("("+x+","+y+") is in first quadrant"); 12 | if(x<0 && y>0) 13 | System.out.print("("+x+","+y+") is in second quadrant"); 14 | if(x<0 && y<0) 15 | System.out.print("("+x+","+y+") is in third quadrant"); 16 | if(x>0 && y<0) 17 | System.out.print("("+x+","+y+") is in fourth quadrant"); 18 | } 19 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part10/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part10; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part11/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part11; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part12/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part12; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part13/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part13; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part5/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part5; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | public String toString() { 30 | return Integer.toString(this.data); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part6/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part6; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part7/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part7; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part8/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part8; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part9/Node.java: -------------------------------------------------------------------------------- 1 | package ch8.part9; 2 | 3 | class Node { 4 | private int data; 5 | private Node next; 6 | 7 | Node(int data) { 8 | this.data=data; 9 | this.next=null; 10 | } 11 | Node() { 12 | this.data=0; 13 | this.next=null; 14 | } 15 | 16 | public void setData(int data) { 17 | this.data=data; 18 | } 19 | public int getData() { 20 | return this.data; 21 | } 22 | 23 | public void setNext(Node next) { 24 | this.next=next; 25 | } 26 | public Node getNext() { 27 | return this.next; 28 | } 29 | 30 | public String toString() { 31 | return Integer.toString(this.data); 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/prog6.java: -------------------------------------------------------------------------------- 1 | /* 2 | * A checksum is a numeric quantity representing and confirming the contents of a file. 3 | * Write a program which reads a string from the user and find its checksum. 4 | */ 5 | 6 | import java.util.*; 7 | 8 | public class prog6 9 | { 10 | public static void main(String args[]) 11 | { 12 | Scanner in = new Scanner(System.in); 13 | System.out.print("Enter a String : "); 14 | String s=in.nextLine(); 15 | int checksum=0; 16 | for(char ch:s.toCharArray()) 17 | { 18 | checksum+=(int)ch; 19 | } 20 | System.out.println("Checksum Value = "+checksum); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part10/test1.java: -------------------------------------------------------------------------------- 1 | package ch6.part10; 2 | 3 | import java.util.Arrays; 4 | 5 | public class test1 { 6 | public static void main(String args[]) { 7 | int arr[] = {1, 2, 3, 4, 5}; 8 | 9 | System.out.println(Arrays.toString(arr)); 10 | for(int i=0; i-1; j--) { 12 | //if(arr[j] arr = new ArrayList(); 8 | System.out.println("Start adding Sentences :"); 9 | for(int i=0; ; i++) 10 | { 11 | String s=in.nextLine(); 12 | if(s.equals("")) 13 | { 14 | break; 15 | } 16 | else 17 | { 18 | arr.add(s); 19 | } 20 | } 21 | System.out.println("Printing the Sentences in Reverse order"); 22 | for(int i=arr.size()-1; i>=0; i--) 23 | { 24 | System.out.println(arr.get(i)); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 7/a7q4.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a7q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("Enter Ten Numbers :"); 8 | double n[] = new double[10]; 9 | for(int a=0; a<10; a++) 10 | { 11 | System.out.print("n["+a+"]="); 12 | n[a]=in.nextDouble(); 13 | } 14 | System.out.println("Smallest Number is the array ="+min(n)); 15 | } 16 | public static double min(double array[]) 17 | { 18 | double t=array[0]; 19 | for(int a=1; a<10; a++) 20 | { 21 | if(t>array[a]) 22 | t=array[a]; 23 | } 24 | return t; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q6.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q6 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("Enter a,b,c,d,e,f"); 8 | double a=in.nextDouble(); 9 | double b=in.nextDouble(); 10 | double c=in.nextDouble(); 11 | double d=in.nextDouble(); 12 | double e=in.nextDouble(); 13 | double f=in.nextDouble(); 14 | double t=a*d-b*c; 15 | if(t==0) 16 | System.out.print("Equation has no solution"); 17 | else 18 | { 19 | double x=(e*d-b*f)/t; 20 | double y=(a*f-e*c)/t; 21 | System.out.print("x="+x+"\ny="+y); 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q20.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q20 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the first number :"); 8 | int n1=in.nextInt(); 9 | System.out.print("Enter the second number :"); 10 | int n2=in.nextInt(); 11 | int a=n1; 12 | int b=n2; 13 | int ans=0; 14 | if (a==0) 15 | ans=b; 16 | while (b!=0) 17 | { 18 | if (a>b) 19 | a=a-b; 20 | else 21 | b=b-a; 22 | ans=a; 23 | } 24 | ans=n1*n2/ans; 25 | System.out.println(ans); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/hw/a5q8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the First Number :"); 8 | int n1=in.nextInt(); 9 | System.out.print("Enter the Second Number :"); 10 | int n2=in.nextInt(); 11 | int sg=0; 12 | if((n1>0 && n2>0) || (n1<0 && n2<0)) 13 | { 14 | sg=1; 15 | } 16 | else 17 | { 18 | sg=-1; 19 | } 20 | int ans=0; 21 | for(int a=1; a<=Math.abs(n2); a++) 22 | { 23 | ans=ans+Math.abs(n1); 24 | } 25 | ans=sg*ans; 26 | System.out.println(n1+"X"+n2+"="+ans); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q11.java: -------------------------------------------------------------------------------- 1 | class a4q11 2 | { 3 | public static void main(String args[]) 4 | { 5 | int s1=0; 6 | for(int a=1; a<=100; a++) 7 | { 8 | s1=s1+a*a; 9 | } 10 | System.out.println("The sum if the squares of the first ten natural numbers is, "+s1); 11 | int s2=0; 12 | for(int a=1; a<=100; a++) 13 | { 14 | s2=s2+a; 15 | } 16 | s2=s2*s2; 17 | System.out.println("The square of the sum of the first ten natural numbers is, "+s2); 18 | System.out.println("Hence the diffenece between the sum of the squares if the first ten natural numbers and the square of the sum is "+s2+" - "+s1+" = "+(s2-s1)); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 5/cw/a5q10.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a5q10 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Value x : "); 8 | double x=in.nextDouble(); 9 | double ans=0; 10 | int n=1; 11 | while(true) 12 | { 13 | int t=2*n-1; 14 | double f=1; 15 | for(int a=1; a<=t; a++) 16 | { 17 | f=f*a; 18 | } 19 | if((Math.pow(x,t)/f) randomPermutation(int n) { 13 | ArrayList arr = new ArrayList(n); 14 | for(int i=0; i generatePrime(int n) { 12 | List arr = new LinkedList(); 13 | arr.add(2); 14 | for(int i=3; i<=n; i+=2) { 15 | boolean isPrime=true; 16 | for(int j:arr) { 17 | if(i%j==0) { 18 | isPrime=false; 19 | break; 20 | } 21 | } 22 | if(isPrime) { 23 | arr.add(i); 24 | } 25 | } 26 | System.out.println("done"); 27 | return arr; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part5/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part5; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList l1 = new LinkedList(); 6 | LinkedList l2 = new LinkedList(); 7 | setUp(l1, l2); 8 | 9 | System.out.println(LinkedList.getCommon(l1, l2)); 10 | } 11 | 12 | private static void setUp(LinkedList l1, LinkedList l2) { 13 | l1.add(new Node(1)); 14 | l1.add(new Node(2)); 15 | l1.add(new Node(3)); 16 | for(int i=4; i<9; i++) { 17 | l2.add(new Node(i)); 18 | } 19 | 20 | l2.add(l2.getHead()); 21 | Node temp=l2.getHead(); 22 | temp=temp.getNext(); 23 | temp=temp.getNext(); 24 | 25 | l1.add(temp); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q5.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class a3q5 3 | { 4 | public static void printArray(E[] inputArray) 5 | { 6 | for(E var: inputArray) 7 | { 8 | System.out.println(var); 9 | } 10 | } 11 | public static void main(String args[]) 12 | { 13 | Scanner in = new Scanner(System.in); 14 | System.out.print("Enter the Size of array :"); 15 | int n=in.nextInt(); 16 | Integer arr[] = new Integer[n]; 17 | for(int i=0; iprintArray(arr); 24 | } 25 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 7/a7q3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a7q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | int arr[] = new int[10]; 8 | for(int a=0; a<10; a++) 9 | { 10 | System.out.print("arr["+a+"]="); 11 | arr[a]=in.nextInt(); 12 | } 13 | int c=0; 14 | System.out.print("Enter the Number to Find :"); 15 | int f=in.nextInt(); 16 | for(int a=0; a<10; a++) 17 | { 18 | if(arr[a]==f) 19 | { 20 | c++; 21 | } 22 | } 23 | if(c!=0) 24 | { 25 | System.out.println(f+" is found "+c+" times"); 26 | } 27 | else 28 | { 29 | System.out.println(f+" is not found"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q4.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q4 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | int arr[][] = new int[4][]; 8 | arr[0] = new int[2]; 9 | arr[1] = new int[4]; 10 | arr[2] = new int[6]; 11 | arr[3] = new int[8]; 12 | for(int a=0; a<4; a++) 13 | { 14 | for(int b=0; b0 && n<=100) 15 | { 16 | no[n-1]++; 17 | } 18 | } 19 | for(int a=0; a<100; a++) 20 | { 21 | if(no[a]!=0) 22 | { 23 | if(no[a]==1) 24 | System.out.println((a+1)+" occurs "+no[a]+" time"); 25 | else 26 | System.out.println((a+1)+" occurs "+no[a]+" times"); 27 | } 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q3 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | double arr[][] = new double[4][4]; 8 | for(int a=0; a<4; a++) 9 | { 10 | for(int b=0; b<4; b++) 11 | { 12 | System.out.print("arr["+a+"]["+b+"]="); 13 | arr[a][b]=in.nextDouble(); 14 | } 15 | } 16 | System.out.println("Sum of the elements in the major diagonal is "+sumMajorDiagonal(arr)); 17 | } 18 | public static double sumMajorDiagonal(double m[][]) 19 | { 20 | double s=0; 21 | int l=m[0].length; 22 | for(int a=0; a l = new LinkedList(1); 8 | l.append(2); 9 | l.append(3); 10 | l.append(4); 11 | l.append(5); 12 | l.append(6); 13 | l.append(7); 14 | l.append(8); 15 | l.append(9); 16 | l.append(10); 17 | 18 | Integer i; 19 | while((i=l.getNext())!=null) { 20 | System.out.println(i); 21 | } 22 | 23 | System.out.println(l.popEnd()+" deleted"); 24 | System.out.println(l.popStart()+" deleted"); 25 | 26 | while((i=l.getNext())!=null) { 27 | System.out.println(i); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 4/a4q2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a4q2 3 | { 4 | public static void main(String arsg[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter a String :"); 8 | String str=in.nextLine(); 9 | System.out.print("Enter the Number of Lines to print :"); 10 | int i=in.nextInt(); 11 | for(int a=1; a<=i; a++) 12 | { 13 | System.out.print(a); 14 | if(a%10==1 && a%100!=11) 15 | System.out.print("st "); 16 | else if(a%10==2 && a%100!=12) 17 | System.out.print("nd "); 18 | else if(a%10==3 && a%100!=13) 19 | System.out.print("rd "); 20 | else 21 | System.out.print("th "); 22 | System.out.println(str); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 6/a6q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a6q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the String :"); 8 | String s=in.nextLine(); 9 | if(palindrome(s)) 10 | System.out.println("The String is pallindrome"); 11 | else 12 | System.out.println("The String is not pallindrome"); 13 | } 14 | public static boolean palindrome(String s) 15 | { 16 | int n=s.length()-1; 17 | boolean k=false; 18 | for(int a=0; arange); 20 | return lower+result; 21 | } 22 | public static int gen() { 23 | return (int)(Math.random()*2); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part2/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part2; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | public class prog1 { 8 | public static void main(String args[]) { 9 | List arr = new ArrayList(); 10 | arr.addAll(Arrays.asList(1,9,9)); 11 | System.out.println(arr); 12 | addOne(arr); 13 | System.out.println(arr); 14 | } 15 | 16 | public static void addOne(List arr) { 17 | int temp=arr.get(arr.size()-1); 18 | temp++; 19 | arr.set(arr.size()-1, temp); 20 | for(int i=arr.size()-1; i>-1; i--) { 21 | if(arr.get(i)==10) { 22 | arr.set(i, 0); 23 | arr.set(i-1, arr.get(i-1)+1); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part4/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part4; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | 7 | public class prog1 { 8 | public static void main(String args[]) { 9 | List arr = new ArrayList(); 10 | arr.addAll(Arrays.asList(3,3,1,0, 2,0,1)); 11 | System.out.println(canReachEnd(arr)); 12 | } 13 | 14 | public static boolean canReachEnd(List arr) { 15 | int furthestReachSoFar=0, lastIndex=arr.size()-1; 16 | for(int i=0; i<=furthestReachSoFar && furthestReachSoFar < lastIndex; i++) { 17 | furthestReachSoFar = Math.max(furthestReachSoFar, i+arr.get(i)); 18 | } 19 | return furthestReachSoFar >=lastIndex; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q15.java: -------------------------------------------------------------------------------- 1 | /*Write a java program to remove the title from a name. 2 | Ex. Input: Mr. Sachin Tendulkar Ms. Saina Nehwal Output: Sachin Tendulkar Saina Nehwal 3 | */ 4 | 5 | import java.util.*; 6 | 7 | public class a3q15 8 | { 9 | public static void main(String args[]) 10 | { 11 | Scanner in = new Scanner(System.in); 12 | System.out.print("Enter a String : "); 13 | String s=in.nextLine(); 14 | in.close(); 15 | StringTokenizer st = new StringTokenizer(s," "); 16 | while(st.hasMoreElements()) 17 | { 18 | String tmp=st.nextToken(); 19 | if(tmp.equalsIgnoreCase("Mr.")) 20 | { 21 | continue; 22 | } 23 | System.out.print(tmp+" "); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q5.java: -------------------------------------------------------------------------------- 1 | /*Write a program to enter a string and print the string in a format which says 2 | that 1st letter of each word present in the string must be printed in capital letters.*/ 3 | 4 | import java.util.*; 5 | 6 | public class a3q5 7 | { 8 | public static void main(String args[]) 9 | { 10 | Scanner in = new Scanner(System.in); 11 | System.out.print("Enter a String : "); 12 | String s=in.nextLine(); 13 | in.close(); 14 | StringTokenizer st = new StringTokenizer(s," "); 15 | while(st.hasMoreElements()) 16 | { 17 | String tmp=(String) st.nextElement(); 18 | System.out.print(tmp.toString().toUpperCase().charAt(0)+tmp.substring(1)+" "); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part6/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part6; 2 | 3 | import java.util.Arrays; 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | 7 | public class prog1 { 8 | public static void main(String args[]) { 9 | List arr = new LinkedList(); 10 | arr.addAll(Arrays.asList(310,315, 275, 295, 260, 270, 290, 230, 255, 250)); 11 | System.out.println(arr); 12 | System.out.println(buy1sell1(arr)); 13 | } 14 | 15 | public static int buy1sell1(List arr) { 16 | int minPrice=Integer.MAX_VALUE; 17 | int maxProfit=0; 18 | for(int p : arr) { 19 | maxProfit=Math.max(maxProfit, p-minPrice); 20 | minPrice=Math.min(minPrice, p); 21 | } 22 | return maxProfit; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part11/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part11; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | String input = "Hello_World"; 6 | 7 | System.out.println(getSnakeString(input)); 8 | } 9 | 10 | private static String getSnakeString(String input) { 11 | char[] arr = input.toCharArray(); 12 | StringBuilder sb = new StringBuilder(); 13 | //level1 14 | for(int i=1; i arr = new LinkedList(); 10 | arr.addAll(Arrays.asList(2,3,5,5,7,11,11,11,13)); 11 | System.out.println(arr); 12 | removeDuplicate(arr); 13 | System.out.println(arr); 14 | } 15 | 16 | public static void removeDuplicate(List arr) { 17 | int lastElement=arr.get(0); 18 | for(int i=1; i0) 19 | { 20 | s=s*10+number%10; 21 | number/=10; 22 | } 23 | return s; 24 | } 25 | public static boolean isPalindrome(int number) 26 | { 27 | return number==reverse(number); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q20.java: -------------------------------------------------------------------------------- 1 | //Write a java program to input a string from user and reverse each word of the string. 2 | 3 | import java.util.*; 4 | 5 | public class a3q20 6 | { 7 | public static void main(String args[]) 8 | { 9 | Scanner in = new Scanner(System.in); 10 | System.out.print("Enter a String : "); 11 | String inp=in.nextLine(); 12 | in.close(); 13 | 14 | StringTokenizer st = new StringTokenizer(inp); 15 | while(st.hasMoreElements()) 16 | { 17 | System.out.print(rev(st.nextToken())+" "); 18 | } 19 | } 20 | private static String rev(String s) 21 | { 22 | String rt=""; 23 | for(int i=s.length()-1; i>-1; i--) 24 | { 25 | rt+=s.charAt(i); 26 | } 27 | return rt; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/classBreakQuestion/prog1.java: -------------------------------------------------------------------------------- 1 | /*Write a Program which reads 2 strings from user and concat the substring from 0 to 5 index of 2 | first string with 0 to 7 index of the second string and print the resultant string.*/ 3 | 4 | package classBreakQuestion; 5 | 6 | import java.util.*; 7 | 8 | public class prog1 9 | { 10 | public static void main(String args[]) 11 | { 12 | Scanner in = new Scanner(System.in); 13 | System.out.print("Enter the First String : "); 14 | String s1=in.nextLine(); 15 | 16 | System.out.print("Enter the Second String : "); 17 | String s2=in.nextLine(); 18 | 19 | String s3=s1.substring(0,5)+s2.substring(0,7); 20 | 21 | System.out.println("Final String : "+s3); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q5 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Equation is ax^2+bx+c=0\na :"); 8 | double a=in.nextDouble(); 9 | System.out.print("b :"); 10 | double b=in.nextDouble(); 11 | System.out.print("c :"); 12 | double c=in.nextDouble(); 13 | double d=b*b-4*a*c; 14 | if(d==0) 15 | System.out.print("Root is ="+(-b/2.0*a)); 16 | else if(d>0) 17 | { 18 | double r1, r2; 19 | d=Math.sqrt(d); 20 | r1=-b+d; 21 | r1=r1/2.0*a; 22 | r2=-b-d; 23 | r2=r2/2.0*a; 24 | System.out.print("roots are \n"+r1+"\n"+r2); 25 | } 26 | else 27 | System.out.print("Roots are imaginary"); 28 | } 29 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 1/mypack/a1q2p1.java: -------------------------------------------------------------------------------- 1 | //Write program to demonstrate the use of class, public, private, static key word of java. 2 | 3 | package mypack; 4 | 5 | public class a1q2p1 { 6 | public String public_Value="I am Public"; 7 | protected String protected_Value="I am Protected"; 8 | String default_Value="I am Default"; 9 | private String private_Value="I am Private"; 10 | public static void main(String args[]) 11 | { 12 | //same class 13 | a1q2p1 ob = new a1q2p1(); 14 | ob.method(); 15 | } 16 | void method() 17 | { 18 | //Accessible 19 | System.out.println(public_Value); 20 | System.out.println(private_Value); 21 | System.out.println(protected_Value); 22 | System.out.println(default_Value); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part9/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part9; 2 | 3 | import java.util.HashMap; 4 | 5 | public class prog1 { 6 | private static HashMap map; 7 | 8 | private static void init() { 9 | map = new HashMap<>(); 10 | map.put('I', 1); 11 | map.put('V', 5); 12 | map.put('X', 10); 13 | map.put('L', 50); 14 | map.put('C', 100); 15 | map.put('D', 500); 16 | map.put('M', 1000); 17 | } 18 | 19 | public static void main(String args[]) { 20 | init(); 21 | String input="XXXXXVIIII"; 22 | System.out.println(r2n(input)); 23 | } 24 | 25 | private static int r2n(String input) { 26 | int value=0; 27 | for(char ch:input.toCharArray()) { 28 | value=value+map.get(ch); 29 | } 30 | return value; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q1 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of m :"); 8 | int m=in.nextInt(); 9 | System.out.print("Enter the value of n :"); 10 | int n=in.nextInt(); 11 | int arr[][] = new int[m][n]; 12 | for(int a=0; a0) 22 | { 23 | s=s*10+n%10; 24 | n/=10; 25 | } 26 | return s; 27 | } 28 | public boolean isPalindrome(int n) 29 | { 30 | return n==reverse(n); 31 | } 32 | public boolean isPrime(int n) 33 | { 34 | int c=0; 35 | for(int a=2; a<=Math.sqrt(n); a++) 36 | { 37 | if(n%a==0) 38 | c++; 39 | } 40 | return c==0; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/prog1.java: -------------------------------------------------------------------------------- 1 | import java.util.StringTokenizer; 2 | 3 | public class prog1 4 | { 5 | public static void main(String args[]) 6 | { 7 | StringTokenizer ob = new StringTokenizer("Hello World of Java"); 8 | while(ob.hasMoreTokens()) 9 | { 10 | System.out.println(ob.nextToken()); 11 | } 12 | System.out.println("---------------------------------"); 13 | 14 | ob = new StringTokenizer("Hello, World| of| Java","|"); 15 | while(ob.hasMoreTokens()) 16 | { 17 | System.out.println(ob.nextToken()); 18 | } 19 | System.out.println("---------------------------------"); 20 | 21 | ob = new StringTokenizer("Hello, World|of|Java","|",true); 22 | while(ob.hasMoreTokens()) 23 | { 24 | System.out.println(ob.nextToken()); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class a3q6 3 | { 4 | public static int count(T[] array, T item) 5 | { 6 | int c=0; 7 | for(T var:array) 8 | { 9 | c=(var.equals(item))?c+1:c; 10 | } 11 | return c; 12 | } 13 | public static void main(String args[]) 14 | { 15 | Scanner in = new Scanner(System.in); 16 | int n=0; 17 | System.out.print("Enter the size of the Array :"); 18 | n=in.nextInt(); 19 | Integer arr[] = new Integer[n]; 20 | for(int i=0; icount(arr,e); 28 | System.out.println(c); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 7/a7q13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a7q13 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Number of Elements in the Array :"); 8 | int n=in.nextInt(); 9 | System.out.println("Enter the Values in the Array :"); 10 | int arr[] = new int[n]; 11 | for(int a=0; alist[a+1]) 29 | return false; 30 | } 31 | return true; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/Student.java: -------------------------------------------------------------------------------- 1 | //a3q3.java 2 | import java.util.*; 3 | public class Student 4 | { 5 | public static void main(String args[]) 6 | { 7 | Scanner in = new Scanner(System.in); 8 | System.out.print("Enter the name of Student :"); 9 | String name=in.nextLine(); 10 | System.out.print("Enter the Marks obtained :"); 11 | int marks=in.nextInt(); 12 | try 13 | { 14 | if(marks>100) 15 | throw new MarksOutOfBoundException("Marks cannot be more than 100"); 16 | System.out.println(name+", you obtained "+marks+" marks"); 17 | } 18 | catch(MarksOutOfBoundException e) 19 | { 20 | System.out.println(e); 21 | } 22 | } 23 | } 24 | class MarksOutOfBoundException extends Exception 25 | { 26 | MarksOutOfBoundException(String s) 27 | { 28 | super(s); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part11/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part11; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | import java.util.Random; 8 | 9 | public class prog1 { 10 | public static void main(String args[]) { 11 | List names = new LinkedList(); 12 | names.addAll(Arrays.asList("Rohan", "Rituraj", "Samarveer", "Rahul", "Arshdeep", "Sanket", "Sahil", "Shivam")); 13 | System.out.println(names); 14 | System.out.println(sampleData(names, 2)); 15 | } 16 | 17 | public static List sampleData(List data, int size) { 18 | Random rd = new Random(); 19 | for(int i=0; iarr[b+1]) 27 | { 28 | double t=arr[b]; 29 | arr[b]=arr[b+1]; 30 | arr[b+1]=t; 31 | } 32 | } 33 | } 34 | return arr; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 1/Student_main.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class Student_main 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter your Name : "); 8 | String name=in.nextLine(); 9 | System.out.print("Enter your Registration Number : "); 10 | long regno=in.nextLong(); 11 | in.nextLine(); 12 | System.out.print("Enter your Branch : "); 13 | String branch=in.nextLine(); 14 | System.out.print("Enter your Section : "); 15 | char section=in.nextLine().charAt(0); 16 | System.out.print("Enter your Mark1 : "); 17 | int mark1=in.nextInt(); 18 | System.out.print("Enter your Marks2 : "); 19 | int mark2=in.nextInt(); 20 | Student ob = new Student(name, branch, section, regno, mark1, mark2); 21 | ob.add(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q14.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | class a3q14 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.println("Enter \n0. Rock\n1. Paper\n2. Scissors"); 8 | int a=in.nextInt(); 9 | int w=0; //win =1, lose=0, tie=2 10 | int b=(int)(Math.random()*3); 11 | if(a==b) 12 | w=2; 13 | else if(a<0||a>2) 14 | w=0; 15 | else 16 | { 17 | if(a==0 && b==1) 18 | w=0; 19 | else if(a==1 && b==2) 20 | w=0; 21 | else if(a==2 && b==0) 22 | w=0; 23 | else 24 | w=1; 25 | } 26 | switch(w) 27 | { 28 | case 0: 29 | System.out.print("You Lost "); 30 | break; 31 | case 1: 32 | System.out.print("You Won"); 33 | break; 34 | case 2: 35 | System.out.print("Its a tie"); 36 | break; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q8 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("enter the value of n:"); 8 | int n=in.nextInt(); 9 | boolean arr[][] = new boolean[n][n]; 10 | for(int a=0; a=1; a--) 32 | { 33 | if(n1%a==0 && n2%a==0) 34 | return a; 35 | } 36 | return 1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 1/a1q1.java: -------------------------------------------------------------------------------- 1 | //a1q1 2 | import java.util.*; 3 | class a1q1 4 | { 5 | public static void main(String args[]) 6 | { 7 | Scanner in = new Scanner(System.in); 8 | System.out.print("Enter the Value of a: "); 9 | int a=in.nextInt(); 10 | System.out.print("Enter the value of b: "); 11 | int b=in.nextInt(); 12 | System.out.print("Enter the value of c: "); 13 | int c=in.nextInt(); 14 | boolean k=false; 15 | if(a+b==c || a==b-c || a*b==c) 16 | k=true; 17 | if(k) 18 | { 19 | System.out.print(a+", "+b+", "+c+" can be used in an arithmatic formula"); 20 | } 21 | else 22 | { 23 | System.out.print(a+", "+b+", "+c+" cannot be used in an arithmatic formula"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part5/prog1.java: -------------------------------------------------------------------------------- 1 | package ch5.part5; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | System.out.println(multiply(3, 7)); 6 | } 7 | public static int multiply(int a, int b) { 8 | int sum = 0; 9 | while(a!=0) { 10 | if((a & 1) == 1) { 11 | sum = add(sum, b); 12 | } 13 | 14 | a>>>=1; 15 | b<<=1; 16 | } 17 | 18 | return sum; 19 | } 20 | private static int add(int a, int b) { 21 | int sum=0, carryin=0, mask=1, tempA=a, tempB=b; 22 | while(tempA!=0 || tempB!=0) { 23 | int ak= a & mask; 24 | int bk= b & mask; 25 | int carryout = (ak & bk) | (ak & carryin) | (bk & carryin); 26 | sum = sum | (ak ^ bk ^ carryin); 27 | carryin = carryout<<1; 28 | tempA>>>=1; 29 | tempB>>>=1; 30 | mask <<=1; 31 | } 32 | return sum | carryin; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part1/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part1; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | System.out.println(parse("-123")); 6 | System.out.println(toString(-123)); 7 | } 8 | private static int parse(String str) { 9 | boolean isNegative=false; 10 | int number=0; 11 | for(char ch:str.toCharArray()) { 12 | if(ch=='-') { 13 | isNegative=true; 14 | continue; 15 | } 16 | number*=10; 17 | number+=((int)(ch))-48; 18 | } 19 | return isNegative?-1*number:number; 20 | } 21 | private static String toString(int num) { 22 | boolean isNegative=num<0; 23 | num=Math.abs(num); 24 | String str=""; 25 | while(num!=0) { 26 | str=(char)(48+num%10)+str; 27 | num/=10; 28 | } 29 | return isNegative?"-"+str:str; 30 | } 31 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 7/a7q6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a7q6 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the Length of the Array :"); 8 | int n=in.nextInt(); 9 | int arr[] = new int[n]; 10 | for(int a=0; a=48 && ch<=57) 23 | d++; 24 | if((ch>=48 && ch<=57) || (ch>=65 && ch<=90)) 25 | k=true; 26 | else 27 | { 28 | k=false; 29 | break; 30 | } 31 | } 32 | if(d>=2 && k && s.length()>=8) 33 | return true; 34 | else 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q14.java: -------------------------------------------------------------------------------- 1 | /*Write a Java program to find first non repeating character in a string . 2 | Example: The given string is: gibblegabbler 3 | The first non repeated character in String is: i*/ 4 | 5 | import java.util.*; 6 | 7 | public class a3q14 8 | { 9 | public static void main(String args[]) 10 | { 11 | Scanner in = new Scanner(System.in); 12 | System.out.print("Enter a String : "); 13 | String inp=in.nextLine(); 14 | inp+=" "; 15 | in.close(); 16 | 17 | for(int i=0; i perm = new LinkedList(); 11 | perm.addAll(Arrays.asList(2, 3, 1, 4)); 12 | System.out.println(perm); 13 | nextPerm(perm); 14 | System.out.println(perm); 15 | } 16 | 17 | public static void nextPerm(List perm) { 18 | int k=-1; 19 | 20 | for(int i=0; ik; i--) { 26 | if(perm.get(i)>perm.get(k)) { 27 | Collections.swap(perm, k, i); 28 | break; 29 | } 30 | } 31 | 32 | Collections.reverse(perm.subList(k+1, perm.size())); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part4/prog1.java: -------------------------------------------------------------------------------- 1 | package ch8.part4; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | LinkedList l1 = new LinkedList(); 6 | LinkedList l2 = new LinkedList(); 7 | LinkedList common = new LinkedList(); 8 | 9 | l1.add(new Node(1)); 10 | l1.add(new Node(2)); 11 | l1.add(new Node(3)); 12 | l1.add(new Node(4)); 13 | 14 | l2.add(new Node(2)); 15 | l2.add(new Node(3)); 16 | l2.add(new Node(4)); 17 | 18 | for(int i=5; i<11; i++) { 19 | Node n = new Node(i); 20 | common.add(n); 21 | } 22 | 23 | l1.add(common.getHead()); 24 | l2.add(common.getHead()); 25 | 26 | System.out.println(l1); 27 | System.out.println(l2); 28 | 29 | LinkedList temp = new LinkedList(); 30 | 31 | Node t = LinkedList.getCommon(l1, l2); 32 | temp.add(t); 33 | 34 | System.out.println("Common Area : "+temp); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 2/a2q7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | interface inter 3 | { 4 | public void display(); 5 | public void count(); 6 | } 7 | class prog7 implements inter 8 | { 9 | static int maxcount; 10 | String name; 11 | prog7(String name, int maxcount) 12 | { 13 | this.name=name; 14 | this.maxcount=maxcount; 15 | } 16 | public void display() 17 | { 18 | System.out.println("Name = "+name); 19 | System.out.println("Max Count = "+maxcount); 20 | } 21 | public void count() 22 | { 23 | 24 | } 25 | } 26 | public class a2q7 27 | { 28 | public static void main(String args[]) 29 | { 30 | Scanner in = new Scanner(System.in); 31 | System.out.print("Enter the Name of the Person : "); 32 | String name=in.nextLine(); 33 | System.out.print("Enter the Max Count : "); 34 | int maxcount=in.nextInt(); 35 | prog7 ob = new prog7(name, maxcount); 36 | ob.display(); 37 | } 38 | } -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part15/prog2.java: -------------------------------------------------------------------------------- 1 | package ch6.part15; 2 | 3 | import java.util.List; 4 | import java.util.LinkedList; 5 | import java.util.Arrays; 6 | 7 | public class prog2 { 8 | public static void main(String args[]) { 9 | List arr = new LinkedList(); 10 | arr.addAll(Arrays.asList(3, 5, 7, 11)); 11 | 12 | List prob = new LinkedList(); 13 | prob.addAll(Arrays.asList(9/18.0, 6/18.0, 2/18.0, 1/18.0)); 14 | 15 | System.out.println(nonUniRandGen(arr, prob)); 16 | } 17 | 18 | public static E nonUniRandGen(List arr,List prob) { 19 | double chance=Math.random(); 20 | double temp=0.0; 21 | int indx=-1; 22 | for(int i=0; i0) { 25 | indx=i; 26 | break; 27 | } 28 | } 29 | 30 | return arr.get(indx); 31 | } 32 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 1/a1q3.java: -------------------------------------------------------------------------------- 1 | class a1q3 2 | { 3 | public static void main(String args[]) 4 | { 5 | System.out.println("RRRRRRRRRRR VV VV"); 6 | System.out.println("R R VV VV"); 7 | System.out.println("R R VV VV"); 8 | System.out.println("R R VV VV"); 9 | System.out.println("RRRRRRRRRRR VV VV"); 10 | System.out.println("RRR VV VV"); 11 | System.out.println("R RR VV VV"); 12 | System.out.println("R RR VV VV"); 13 | System.out.println("R RR VV VV"); 14 | System.out.println("R RR VV VV"); 15 | System.out.println("R RR VVVV"); 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/classBreakQuestion/prog4.java: -------------------------------------------------------------------------------- 1 | /*Write a program which read a string from user 2 | *and remove all token form the string and create 3 | *an output string which consist of string without 4 | *any token of the input string. 5 | */ 6 | 7 | package classBreakQuestion; 8 | 9 | import java.util.Scanner; 10 | import java.util.StringTokenizer; 11 | 12 | public class prog4 13 | { 14 | public static void main(String args[]) 15 | { 16 | Scanner in = new Scanner(System.in); 17 | System.out.print("Enter a String : "); 18 | String s = in.nextLine(); 19 | System.out.print("Enter the Token : "); 20 | String token = in.nextLine(); 21 | StringTokenizer st = new StringTokenizer(s,token); 22 | 23 | StringBuilder sb = new StringBuilder(); 24 | while(st.hasMoreElements()) 25 | { 26 | sb.append(st.nextToken()); 27 | } 28 | System.out.println(sb); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part5/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part5; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | String input="abc cac cba."; 6 | 7 | System.out.println(isPalindrome(input)); 8 | } 9 | 10 | private static boolean isPalindrome(String str) { 11 | return check(str, 0, str.length()-1); 12 | } 13 | 14 | private static boolean check(String str, int start, int end) { 15 | start=offShift(str, start, 1); 16 | end=offShift(str, end, -1); 17 | if(start>=end) { 18 | return true; 19 | } 20 | if(str.charAt(start)!=str.charAt(end)) { 21 | return false; 22 | } 23 | return check(str, ++start, --end); 24 | } 25 | 26 | private static int offShift(String str, int inp, int dir) { 27 | while(!Character.isLetterOrDigit(str.charAt(inp))) { 28 | inp=inp+dir; 29 | } 30 | return inp; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch5/part11/Rectangle.java: -------------------------------------------------------------------------------- 1 | package ch5.part11; 2 | 3 | public class Rectangle { 4 | private double x, y, width, height; 5 | 6 | public Rectangle(double x, double y, double width, double height) { 7 | this.x=x; 8 | this.y=y; 9 | this.width=width; 10 | this.height=height; 11 | } 12 | 13 | public static boolean intersects(Rectangle r1, Rectangle r2) { 14 | if(r1.x <= r2.x && (r1.x+r1.width) <= (r2.x+r2.width)) { 15 | return (r1.y+r1.height)>=r2.y || (r1.x+r1.width)>=r2.x; 16 | } 17 | if(r2.x <= r1.x && (r2.x+r2.width) <= (r1.x+r1.width)) { 18 | return (r2.y+r2.height)>=r1.y || (r2.x+r2.width)>=r1.x; 19 | } 20 | if(r1.y <= r2.y && (r1.y+r1.height) <= (r2.y+r2.height)) { 21 | return (r1.x+r1.width)>=r2.x; 22 | } 23 | if(r2.y <= r1.y && (r2.y+r2.height) <= (r1.y+r1.height)) { 24 | return (r2.x+r2.width)>=r1.x; 25 | } 26 | return false; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 1/Point.java: -------------------------------------------------------------------------------- 1 | //a1q11 2 | import java.util.*; 3 | public class Point 4 | { 5 | int x, y; 6 | Point() 7 | { 8 | x=0; 9 | y=0; 10 | } 11 | public void setPoint() 12 | { 13 | Scanner in = new Scanner(System.in); 14 | System.out.print("Enter the Value of x :"); 15 | x=in.nextInt(); 16 | System.out.print("Enter the Value of y :"); 17 | y=in.nextInt(); 18 | } 19 | public void findDistance(Point ob1, Point ob2) 20 | { 21 | int x1=ob1.x; 22 | int y1=ob1.y; 23 | int x2=ob2.x; 24 | int y2=ob2.y; 25 | double d=(x2-x1)*(x2-x1)+(y2-y2)*(y2-y1); 26 | d=Math.sqrt(d); 27 | System.out.println("Distance between the points = "+d); 28 | } 29 | public static void main(String args[]) 30 | { 31 | Point ob1 = new Point(); 32 | Point ob2 = new Point(); 33 | Point ob = new Point(); 34 | ob1.setPoint(); 35 | ob2.setPoint(); 36 | ob.findDistance(ob1, ob2); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q12.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class a3q12 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the size of the array :"); 8 | int n=in.nextInt(); 9 | int arr[] = new int[n]; 10 | System.out.println("Enter the Elements in the array in accending order :"); 11 | for(int i=0; iarr[m]) 27 | { 28 | return search(arr, e, m+m/2); 29 | } 30 | else 31 | { 32 | return search(arr, e, m-m/2); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q7.java: -------------------------------------------------------------------------------- 1 | /*Write a program to enter a name as string and print the name in shorter manner. 2 | Ex: Ram Chandra Dash will become R.C.Dash 3 | */ 4 | 5 | import java.util.*; 6 | 7 | public class a3q7 8 | { 9 | public static void main(String args[]) 10 | { 11 | Scanner in = new Scanner(System.in); 12 | System.out.print("Enter a String : "); 13 | String s=in.nextLine(); 14 | in.close(); 15 | StringTokenizer st = new StringTokenizer(s," "); 16 | int cnt=st.countTokens(); 17 | while(st.hasMoreElements()) 18 | { 19 | String tmp=(String) st.nextElement(); 20 | System.out.print(tmp.toString().toUpperCase().charAt(0)+"."); 21 | cnt--; 22 | if(cnt==1) 23 | break; 24 | } 25 | if(st.hasMoreElements()) 26 | { 27 | String tmp=st.nextToken(); 28 | System.out.print(tmp.toString().toUpperCase().charAt(0)+tmp.substring(1)); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part9/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part9; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | 8 | public class prog1 { 9 | public static void main(String args[]) { 10 | List perm = new LinkedList(); 11 | perm.addAll(Arrays.asList(3, 2, 1, 0)); 12 | List arr = new LinkedList(); 13 | arr.addAll(Arrays.asList('a', 'b', 'c', 'd')); 14 | 15 | System.out.println(arr); 16 | applyPermutation(perm, arr); 17 | System.out.println(arr); 18 | } 19 | 20 | public static void applyPermutation(List perm, List arr) { 21 | for(int i=0; iperm.get(j+1)) { 24 | Collections.swap(perm, j, j+1); 25 | Collections.swap(arr, j, j+1); 26 | } 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment on Interacting with the Environment/prog6.java: -------------------------------------------------------------------------------- 1 | /*. Write a program which ask the user to enter a jar file name and check 2 | whether the jar file is install or not.*/ 3 | import java.io.File; 4 | import java.util.*; 5 | 6 | public class prog6 { 7 | public static void main(String[] args) { 8 | Scanner in = new Scanner(System.in); 9 | System.out.print("Enter the File Location : "); 10 | File f1 = new File(in.nextLine()); 11 | in.close(); 12 | String[] List = f1.list(); 13 | for(String str1 : List) { 14 | int i = str1.lastIndexOf('.'); 15 | String ext=str1.substring(i+1); 16 | if(ext.equals("jar")){ 17 | System.out.println("Jar File"); 18 | } 19 | else{ 20 | System.out.println("Not a Jar File"); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch7/part13/prog1.java: -------------------------------------------------------------------------------- 1 | package ch7.part13; 2 | 3 | public class prog1 { 4 | public static void main(String args[]) { 5 | String text="a good string search algo is fundamental to the performance of many applications. sveral clever alo have been proposed."; 6 | String searchString="performance"; 7 | 8 | System.out.println(search(text, searchString)); 9 | } 10 | 11 | private static int search(String text, String s) { 12 | int startFrom=0; 13 | boolean found=false; 14 | boolean indexing=false; 15 | 16 | for(int i=0; iarr[a]) 37 | { 38 | n=arr[a]; 39 | } 40 | } 41 | return n; 42 | } 43 | } -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment 3/a3q18.java: -------------------------------------------------------------------------------- 1 | //Write a java code to find the longest substring without repeating characters in the given string. 2 | 3 | import java.util.*; 4 | 5 | public class a3q18 6 | { 7 | public static void main(String args[]) 8 | { 9 | Scanner in = new Scanner(System.in); 10 | System.out.print("Enter a String : "); 11 | String inp=in.nextLine(); 12 | in.close(); 13 | String biggest=""; 14 | 15 | for(int i=0; ibiggest.length()?inp.substring(i,j):biggest:biggest; 20 | } 21 | } 22 | System.out.println("Output : "+biggest); 23 | } 24 | private static boolean repeat(String inp) 25 | { 26 | inp+=" "; 27 | for(int i=0; i2) 30 | { 31 | return false; 32 | } 33 | } 34 | return true; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part1/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part1; 2 | 3 | import java.util.Arrays; 4 | import java.util.Collections; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | 8 | public class prog1 { 9 | private static enum Color {RED, WHITE, BLUE} 10 | 11 | public static void main(String args[]) { 12 | List arr = new LinkedList(); 13 | arr.addAll(Arrays.asList(Color.RED, Color.WHITE, Color.BLUE, Color.RED, Color.WHITE, Color.BLUE, Color.RED, Color.WHITE, Color.BLUE)); 14 | System.out.println(arr); 15 | dutchFlag(arr); 16 | System.out.println(arr); 17 | } 18 | 19 | public static void dutchFlag(List arr) { 20 | int low=0, mid=0, high=arr.size()-1; 21 | while(mid<=high) { 22 | switch(arr.get(mid).ordinal()) { 23 | case 0: 24 | Collections.swap(arr, mid++, low++); 25 | break; 26 | case 1: 27 | mid++; 28 | break; 29 | case 2: 30 | Collections.swap(arr, mid, high--); 31 | break; 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch8/part6/LinkedList.java: -------------------------------------------------------------------------------- 1 | package ch8.part6; 2 | 3 | 4 | class LinkedList { 5 | private Node head; 6 | 7 | LinkedList() { 8 | this.head=null; 9 | } 10 | 11 | public void add(int data) { 12 | if(head==null) { 13 | head=new Node(data); 14 | return; 15 | } 16 | 17 | Node temp=head; 18 | while(temp.getNext()!=null) { 19 | temp=temp.getNext(); 20 | } 21 | 22 | temp.setNext(new Node(data)); 23 | } 24 | 25 | public Node getHead() { 26 | return this.head; 27 | } 28 | 29 | public static void deleteNode(Node temp) { 30 | temp.setNext(temp.getNext().getNext()); 31 | } 32 | 33 | public String toString() { 34 | Node temp=head; 35 | StringBuilder sb = new StringBuilder(); 36 | sb.append('['); 37 | sb.append(temp.getData()); 38 | temp=temp.getNext(); 39 | while(temp!=null) { 40 | sb.append(", "); 41 | sb.append(temp.getData()); 42 | temp=temp.getNext(); 43 | } 44 | sb.append(']'); 45 | return sb.toString(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q2 3 | { 4 | public static void main(String args[]) 5 | { 6 | double arr[][] = new double[3][4]; 7 | Scanner in = new Scanner(System.in); 8 | System.out.println("Enter the values in array :"); 9 | for(int a=0; a<3; a++) 10 | { 11 | for(int b=0; b<4; b++) 12 | { 13 | System.out.print("arr["+a+"]["+b+"]="); 14 | arr[a][b]=in.nextDouble(); 15 | } 16 | } 17 | System.out.println("Entered array :"); 18 | for(int a=0; a<3; a++) 19 | { 20 | for(int b=0; b<4; b++) 21 | { 22 | System.out.print(arr[a][b]+"\t"); 23 | } 24 | System.out.println(); 25 | } 26 | for(int b=0; b<4; b++) 27 | { 28 | System.out.println("Sum of the elements at column "+b+" is "+sumColumn(arr, b)); 29 | } 30 | } 31 | public static double sumColumn(double m[][], int columnIndex) 32 | { 33 | double s=0; 34 | for(int a=0; a<3; a++) 35 | { 36 | s=s+m[a][columnIndex]; 37 | } 38 | return s; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part7/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part7; 2 | 3 | import java.util.Arrays; 4 | import java.util.LinkedList; 5 | import java.util.List; 6 | 7 | public class prog1 { 8 | public static void main(String args[]) { 9 | List arr = new LinkedList(); 10 | arr.addAll(Arrays.asList(12,11,13,9,12,8,14,13,15)); 11 | System.out.println(arr); 12 | System.out.println(buy2sell2(arr)); 13 | } 14 | 15 | public static int buy2sell2(List arr) { 16 | List pr = new LinkedList(); 17 | int maxProfit=0, minPrice=Integer.MAX_VALUE; 18 | 19 | for(int p:arr) { 20 | minPrice=Math.min(minPrice, p); 21 | maxProfit=Math.max(maxProfit, p-minPrice); 22 | pr.add(maxProfit); 23 | } 24 | 25 | int maxPrice=Integer.MIN_VALUE; 26 | for(int i=arr.size()-1; i>0; i--) { 27 | maxPrice=Math.max(maxPrice, arr.get(i)); 28 | maxProfit=Math.max(maxProfit, maxPrice-arr.get(i)+pr.get(i-1)); 29 | } 30 | 31 | return maxProfit; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Assignments/Assignment On Regular Expression/prog3.java: -------------------------------------------------------------------------------- 1 | // Java program to check URL is valid or not 2 | // using Regular Expression 3 | 4 | import java.util.regex.*; 5 | import java.util.*; 6 | class prog3 7 | { 8 | public static void main(String args[]) 9 | { 10 | Scanner in = new Scanner(System.in); 11 | System.out.print("Enter a String : "); 12 | String url=in.nextLine(); 13 | in.close(); 14 | String regex="\\w+@\\w+(\\.\\w+)"; 15 | 16 | Pattern p = Pattern.compile(regex); 17 | Matcher m1 = p.matcher(url); 18 | 19 | regex="(http:\\/\\/|https:\\/\\/)?([w]{3}\\.)?\\w+(\\.(com|in|org|ac|gov|co))+"; 20 | 21 | p = Pattern.compile(regex); 22 | Matcher m2 = p.matcher(url); 23 | 24 | if (m1.matches()||m2.matches()) 25 | { 26 | System.out.println("Yes"); 27 | } 28 | else 29 | { 30 | System.out.println("NO"); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q5.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q5 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the value of m :"); 8 | int m=in.nextInt(); 9 | System.out.print("Enter the value of n :"); 10 | int n=in.nextInt(); 11 | int arr[][] = new int[m+1][n+2]; 12 | for(int a=0; a arr = new LinkedList(); 11 | arr.add(1); 12 | while(arr.size() process(LinkedList arr) { 20 | LinkedList buffer = new LinkedList(); 21 | int count=0; 22 | int digit=arr.get(0); 23 | for(int i:arr) { 24 | if(digit==i) { 25 | count++; 26 | } 27 | else { 28 | buffer.add(count); 29 | buffer.add(digit); 30 | digit=i; 31 | count=1; 32 | } 33 | } 34 | 35 | buffer.add(count); 36 | buffer.add(digit); 37 | 38 | return buffer; 39 | } 40 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 3/a3q9.java: -------------------------------------------------------------------------------- 1 | class a3q9 2 | { 3 | public static void main(String args[]) 4 | { 5 | int rd=1+(int)(Math.random()*12); 6 | System.out.println("Selected Number ="+rd); 7 | System.out.print("The month is "); 8 | switch(rd) 9 | { 10 | case 1: 11 | System.out.print("January"); 12 | break; 13 | case 2: 14 | System.out.print("Febuary"); 15 | break; 16 | case 3: 17 | System.out.print("March"); 18 | break; 19 | case 4: 20 | System.out.print("April"); 21 | break; 22 | case 5: 23 | System.out.print("May"); 24 | break; 25 | case 6: 26 | System.out.print("June"); 27 | break; 28 | case 7: 29 | System.out.print("July"); 30 | break; 31 | case 8: 32 | System.out.print("August"); 33 | break; 34 | case 9: 35 | System.out.print("September"); 36 | break; 37 | case 10: 38 | System.out.print("October"); 39 | break; 40 | case 11: 41 | System.out.print("November"); 42 | break; 43 | case 12: 44 | System.out.print("December"); 45 | break; 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q10.java: -------------------------------------------------------------------------------- 1 | class a8q10 2 | { 3 | public static void main(String args[]) 4 | { 5 | int arr[][] = new int[4][4]; 6 | for(int a=0; a<4; a++) 7 | { 8 | for(int b=0; b<4; b++) 9 | { 10 | arr[a][b]=(int)(Math.random()*2); 11 | } 12 | } 13 | for(int a=0; a<4; a++) 14 | { 15 | for(int b=0; b<4; b++) 16 | { 17 | System.out.print(arr[a][b]+"\t"); 18 | } 19 | System.out.println(); 20 | } 21 | int p=0,v=0; 22 | for(int a=0; a<4; a++) 23 | { 24 | int c=0; 25 | for(int b=0; b<4; b++) 26 | { 27 | c=c+arr[a][b]; 28 | } 29 | System.out.println(c); 30 | if(c>v) 31 | { 32 | v=c; 33 | p=a; 34 | } 35 | } 36 | System.out.println("The Largest row index ="+p); 37 | p=0; 38 | v=0; 39 | for(int a=0; a<4; a++) 40 | { 41 | int c=0; 42 | for(int b=0; b<4; b++) 43 | { 44 | c=c+arr[b][a]; 45 | } 46 | System.out.println(c); 47 | if(c>v) 48 | { 49 | v=c; 50 | p=a; 51 | } 52 | } 53 | System.out.println("The Coloumn row index ="+p); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/prog3.java: -------------------------------------------------------------------------------- 1 | 2 | public class prog3 3 | { 4 | public static void main(String args[]) 5 | { 6 | StringBuilder strl = new StringBuilder("Rashimi Rekha Sahoo"); 7 | System.out.println("string1 - " + strl); 8 | 9 | // returns the current capacity of the string Builder 1 10 | System.out.println("Old Capacity = " + strl. capacity()); 11 | /* increases the capacity, as needed, to the specified amount in the 12 | given StringBuiIder object */ 13 | // returns twice the capacity plus 2 14 | 15 | strl.ensureCapacity(40) ; 16 | System.out.println("New Capacity = " + strl. capacity()); 17 | StringBuilder str2 = new StringBuilder("compile online"); 18 | System.out.println("String2 = " + str2); 19 | 20 | // returns the current capacity of string Builder 2 21 | System.out.println("Old Capacity = " + str2. capacity()); 22 | /* returns the old capacity as the capacity 23 | old capacity */ 24 | str2.ensureCapacity(29); 25 | 26 | System.out.println("New Capacity = "+ str2.capacity()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Semester 3 (CWS-1)/Class Works/class 4/prog6files.java: -------------------------------------------------------------------------------- 1 | /* 2 | * A checksum is a numeric quantity representing and confirming the contents of a file. 3 | * Write a program which reads a string file location from the user and find checksum of the file. 4 | */ 5 | 6 | import java.io.*; 7 | import java.util.*; 8 | 9 | public class prog6files 10 | { 11 | public static void main(String args[]) 12 | { 13 | Scanner in = new Scanner(System.in); 14 | 15 | System.out.print("Enter the File Location : "); 16 | String s=in.nextLine(); 17 | try 18 | { 19 | FileReader f = new FileReader(s); 20 | BufferedReader fs = new BufferedReader(f); 21 | 22 | int checksum=0; 23 | while(true) 24 | { 25 | String val=fs.readLine(); 26 | if(val==null) 27 | break; 28 | for(char ch:val.toCharArray()) 29 | { 30 | checksum+=ch; 31 | } 32 | } 33 | 34 | fs.close(); 35 | System.out.println("Checksum Value = "+checksum); 36 | } 37 | catch(IOException e) 38 | { 39 | System.err.println("Error: File Not Found"); 40 | } 41 | in.close(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Semester 4 (CSW-2)/ch6/part12/prog1.java: -------------------------------------------------------------------------------- 1 | package ch6.part12; 2 | 3 | import java.util.Arrays; 4 | import java.util.Iterator; 5 | import java.util.LinkedList; 6 | import java.util.List; 7 | import java.util.Random; 8 | 9 | public class prog1 { 10 | public static void main(String args[]) { 11 | List names = new LinkedList(); 12 | names.addAll(Arrays.asList("Rohan", "Rituraj", "Samarveer", "Rahul", "Arshdeep", "Sanket", "Sahil", "Shivam")); 13 | System.out.println(names); 14 | System.out.println(SampleSelector(names.iterator(), 2)); 15 | } 16 | 17 | public static List SampleSelector(Iterator data, int size) { 18 | LinkedList selections = new LinkedList(); 19 | 20 | for(int i=0; i arr = new LinkedList(); 11 | arr.addAll(Arrays.asList(3, 5, 7, 11)); 12 | 13 | List prob = new LinkedList(); 14 | prob.addAll(Arrays.asList(9/18.0, 6/18.0, 2/18.0, 1/18.0)); 15 | 16 | System.out.println(nonUniRand(arr, prob, 100)); 17 | } 18 | 19 | public static List nonUniRand(List arr, List prob, int calls) { 20 | List rt = new LinkedList(); 21 | 22 | for(int i=0; iMath.max(n1,n2)) 40 | break; 41 | } 42 | l=l*n1*n2; 43 | return l; 44 | } 45 | public int commonD(int r,int a, int l) 46 | { 47 | int m=l/a; 48 | return r*m; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Semester 1 (ICP)/assignment 8/cw/a8q6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | class a8q6 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | double n1[][] = new double[3][3]; 8 | double n2[][] = new double[3][3]; 9 | for(int a=0; a<3; a++) 10 | { 11 | for(int b=0; b<3; b++) 12 | { 13 | System.out.print("n1["+a+"]["+b+"]="); 14 | n1[a][b]=in.nextDouble(); 15 | } 16 | } 17 | for(int a=0; a<3; a++) 18 | { 19 | for(int b=0; b<3; b++) 20 | { 21 | System.out.print("n2["+a+"]["+b+"]="); 22 | n2[a][b]=in.nextDouble(); 23 | } 24 | } 25 | double arr[][]=addMatrix(n1,n2); 26 | for(int a=0; a<3; a++) 27 | { 28 | for(int b=0; b<3; b++) 29 | { 30 | System.out.print(arr[a][b]+"\t"); 31 | } 32 | System.out.println(); 33 | } 34 | } 35 | public static double[][] addMatrix(double a[][], double b[][]) 36 | { 37 | double arr[][] = new double[a.length][a[0].length]; 38 | for(int i=0; i<3; i++) 39 | { 40 | for(int j=0; j<3; j++) 41 | { 42 | arr[i][j]=a[i][j]+b[i][j]; 43 | } 44 | } 45 | return arr; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Semester 2 (DSA)/assignment 3/a3q17.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | public class a3q17 3 | { 4 | public static void main(String args[]) 5 | { 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter the size of the array :"); 8 | int n=in.nextInt(); 9 | int arr[] = new int[n]; 10 | System.out.println("Enter the Elements in the array :"); 11 | for(int i=0; ip) 33 | p2--; 34 | else if(arr[p1]==arr[p2]) 35 | p1++; 36 | else 37 | { 38 | int t=arr[p1]; 39 | arr[p1]=arr[p2]; 40 | arr[p2]=t; 41 | } 42 | } 43 | return quicksort(arr,p,p1,p2); 44 | } 45 | else 46 | return arr; 47 | } 48 | } --------------------------------------------------------------------------------