From 13aeaf05d47f52a59dac41e86a61fa7039dad916 Mon Sep 17 00:00:00 2001 From: Shubhipandey21 <103507502+Shubhipandey21@users.noreply.github.com> Date: Thu, 29 Sep 2022 18:23:44 +0530 Subject: [PATCH 1/6] Create Hello World.txt Code for printing hello world --- .../Hello World.txt | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/Hello World.txt diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/Hello World.txt b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/Hello World.txt new file mode 100644 index 00000000..b41bb3d6 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/Hello World.txt @@ -0,0 +1,7 @@ +#include +#include +int main() +{ +cout<<"Hello World"< Date: Fri, 7 Oct 2022 00:45:23 +0530 Subject: [PATCH 2/6] print Z.cpp --- .../GettingStarted/GradingSystem.cpp | 17 ++++++++ .../GettingStarted/IsaPrimenumber.cpp | 24 +++++++++++ .../GettingStarted/PrintallprimestillN.cpp | 40 +++++++++++++++++++ .../printFibonaccinumberstillN.cpp | 23 +++++++++++ .../GettingStarted/printZ.cpp | 9 +++++ .../Hello World.txt | 7 ---- 6 files changed, 113 insertions(+), 7 deletions(-) create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/GradingSystem.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/IsaPrimenumber.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/PrintallprimestillN.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/printFibonaccinumberstillN.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/printZ.cpp delete mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/Hello World.txt diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/GradingSystem.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/GradingSystem.cpp new file mode 100644 index 00000000..9836e5c1 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/GradingSystem.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; +int main(int argc, char**argv){ + int marks; + cin>>marks; + if(marks>90) + cout<<"excellent"<80 && marks<=90) + cout<<"good"<70 && marks<=80 ) + cout<<"fair"<60 && marks<=70) + cout<<"meets expectations"< +using namespace std; +int main(int argc, char **argv){ + int t,n,m,i,COUNT =0; + cin >> t; + while(t--) + { + { + cin >> n; + COUNT=0; + for(m=2;m +using namespace std; + +void primeInRange(int low, int high) +{ + int flag; + + + for (int i = low; i <=high; i++) { + + if (i == 1 || i == 0) + continue; + + flag = 1; + + + for (int j = 2; j <= i / 2; ++j) { + if (i % j == 0) { + flag = 0; + break; + } + } + + + if (flag == 1) + cout << i << endl; + } +} + + +int main() +{ + + int low,high; + cin>>low>>high; + + primeInRange(low, high); + + return 0; +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/printFibonaccinumberstillN.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/printFibonaccinumberstillN.cpp new file mode 100644 index 00000000..b737177c --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/GettingStarted/printFibonaccinumberstillN.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; + +int main() { + int n, t1 = 0, t2 = 1, nextTerm = 0; + cin>>n; + for (int i = 1; i <= n; ++i) { + if(i == 1) { + cout << t1 < +using namespace std; +int main(int argc, char** agrc) { + cout<<"***"< -#include -int main() -{ -cout<<"Hello World"< Date: Mon, 7 Nov 2022 21:13:03 +0530 Subject: [PATCH 3/6] pattern --- .../patterns/pattern1.cpp | 18 +++++++++ .../patterns/pattern2.cpp | 16 ++++++++ .../patterns/pattern3.cpp | 37 +++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern1.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern2.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern3.cpp diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern1.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern1.cpp new file mode 100644 index 00000000..9f00eb35 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern1.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + +int main(int argc, char **argv){ + int n; + cin >> n; + for(int i = 1; i <= n; ++i) + { + for(int j = 1; j <= i; ++j) + { + cout << "* "; + cout<<"\t"; + } + cout << "\n"; + } + //write your code here +    +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern2.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern2.cpp new file mode 100644 index 00000000..0463c096 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern2.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; + +int main(int argc, char **argv){ + int n; + cin >> n; + for(int i = n; i >= 1; --i) + { + for(int j = 1; j <= i; ++j) + { + cout << "*\t"; + } + cout << endl; +    } +     +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern3.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern3.cpp new file mode 100644 index 00000000..a96aa6c3 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern3.cpp @@ -0,0 +1,37 @@ +#include +using namespace std; + +void pypart2(int n) +{ + int i = 0, j = 0, k = 0; + while (i < n) { + + + while (k < (n - i - 1)) { + cout << " \t"; + k++; + } + + + k = 0; + while (j <= i) { + cout << "*\t "; + j++; + } + + + j = 0; + i++; + cout << endl; + } +} + + +int main() +{ + int n = 5; + + + pypart2(n); +    return 0; +} From 4302d2e756080f447fb55501f11bea58d7ae4bee Mon Sep 17 00:00:00 2001 From: Shubhipandey21 <103507502+Shubhipandey21@users.noreply.github.com> Date: Wed, 16 Nov 2022 00:23:49 +0530 Subject: [PATCH 4/6] 2d array --- .../2Darray/2d array demo.cpp | 26 ++++++++ .../2Darray/The state of wakanda 1.cpp | 44 +++++++++++++ .../2Darray/matrixmultiplication.java | 54 ++++++++++++++++ .../2Darray/spiral display.cpp | 61 +++++++++++++++++++ 4 files changed, 185 insertions(+) create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp new file mode 100644 index 00000000..8acb9a82 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; +int main() { + int n; + int m; + cin >> n; + cin >> m; + + vector>marr; + for (int i = 0; i < n; i++) { + vectorsarr; + for (int j = 0; j < m; j++) { + int ele; + cin >> ele; + sarr.push_back(ele); + } + marr.push_back(sarr); + } + + for (int i = 0; i < n; i++) { + for (int j = 0; j < m; j++) { + cout << marr[i][j] << " "; + } + cout << endl; +  } +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp new file mode 100644 index 00000000..4c19077a --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp @@ -0,0 +1,44 @@ +#include +#include + +using namespace std; + +void columnTraversal(vector> mat) { + int row = mat.size(); + int col = mat[0].size(); + + for (int c = 0; c < col; c++) { + if (c % 2 == 0) { + for (int r = 0; r < row; r++) { + cout << mat[r][c]; + cout << endl; + } + } + else { + for (int r = row - 1; r >= 0; r--) { + cout << mat[r][c]; + cout << endl; + } + } + } +} + +int main() { + int n; + int m; + cin >> n; + cin >> m; + + vector> mat; + for (int i = 0; i < n; i++) { + vector arr; + for (int j = 0; j < m; j++) { + int ele; + cin >> ele; + arr.push_back(ele); + } + mat.push_back(arr); + } + + columnTraversal(mat); +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java new file mode 100644 index 00000000..c945dd05 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java @@ -0,0 +1,54 @@ +import java.io.*; +import java.util.*; + +public class Main { + + public static void main(String[] args) throws Exception { + BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); + int n1 = Integer.parseInt(br.readLine()); + int m1 = Integer.parseInt(br.readLine()); + int[][] arr1 = new int[n1][m1]; + + for (int i = 0; i < n1; i++) { + for (int j = 0; j < m1; j++) { + arr1[i][j] = Integer.parseInt(br.readLine()); + } + } + + int n2 = Integer.parseInt(br.readLine()); + int m2 = Integer.parseInt(br.readLine()); + int[][] arr2 = new int[n2][m2]; + + for (int i = 0; i < n2; i++) { + for (int j = 0; j < m2; j++) { + arr2[i][j] = Integer.parseInt(br.readLine()); + } + } + + if (m1 != n2) { + System.out.println("Invalid input"); + return; + } + + int[][] prd = new int[n1][m2]; + for (int i = 0; i < n1; i++) { + for (int j = 0; j < m2; j++) { + int sum = 0; + + for (int k = 0; k < m1; k++) { + sum += arr1[i][k] * arr2[k][j]; + } + + prd[i][j] = sum; + } + } + + for (int i = 0; i < n1; i++) { + for (int j = 0; j < m2; j++) { + System.out.print(prd[i][j] + " "); + } + System.out.println(); +      } + +   } +} \ No newline at end of file diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp new file mode 100644 index 00000000..cc56d903 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp @@ -0,0 +1,61 @@ +#include +using namespace std; + +const int mr = 100, mc = 100; +void inputBound(int (&mat)[mr][mc], int n, int m) +{ + + for (int i = 0; i < n; i++) + { + for (int j = 0; j < m; j++) + { + cin >> mat[i][j]; + } + } +} + +int main(int argc, char** argv) +{ + + + int mat[mr][mc] = {0}; + int n, m; + cin >> n >> m; + + inputBound(mat, n, m); + int toe = n * m; + int count = 0; + int minr = 0, minc = 0, maxr = n - 1, maxc = m - 1; + + while (count < toe) + { + + //left wall + for (int i = minr, j = minc ; i <= maxr && count < toe ; i++) { + cout << mat[i][minc] << endl; + count++; + } + minc++; + //bottom wall + for (int i = maxr, j = minc ; j <= maxc && count < toe ; j++) { + cout << mat[maxr][j] << endl; + count++; + } + maxr--; + //right wall + for (int i = maxr, j = maxc ; i >= minr && count < toe ; i--) { + cout << mat[i][maxc] << endl; + count++; + } + maxc--; + //top wall + for (int i = minr, j = maxc ; j >= minc && count < toe ; j--) { + cout << mat[minr][j] << endl; + count++; + } + minr++; + } + // write your code here + +  return 0; +} From bd0745798455d140ef4d731da0255c0a5241d8ec Mon Sep 17 00:00:00 2001 From: Shubhipandey21 <103507502+Shubhipandey21@users.noreply.github.com> Date: Thu, 17 Nov 2022 08:39:23 +0530 Subject: [PATCH 5/6] pattern --- .../patterns/pattern4.cpp | 34 +++++++++++++++++ .../patterns/pattern5.cpp | 32 ++++++++++++++++ .../patterns/pattern6.cpp | 38 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern4.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern5.cpp create mode 100644 AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern6.cpp diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern4.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern4.cpp new file mode 100644 index 00000000..98c7b522 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern4.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; + +// Pattern 4 +void pattern4(int n) +{ + + int k = 2 * n - 2; + + + for (int i = n; i > 0; i--) { + + for (int j = 0; j < n - i; j++) + cout << " "; + k = k - 2; + + for (int j = 0; j < i; j++) { + + cout << "* "; + } + + + cout << endl; + } +} + +int main() +{ + int n = 5; + + + pattern4(n); +    return 0; +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern5.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern5.cpp new file mode 100644 index 00000000..41833960 --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern5.cpp @@ -0,0 +1,32 @@ +using namespace std; + +int main() +{ + int n, c, k, space = 1; + + cout << “\nEnter the number of rows : “; + cin >> n; + + space = n – 1; + + for (k = 1; k <= n; k++) + { + for (c = 1; c <= space; c++) + cout << ” “; + space--; + for (c = 1; c <= 2*k-1; c++) + cout << “*”; + cout << endl; +} + space = 1; + for (k = 1; k <= n – 1; k++) + { + for (c = 1; c <= space; c++) + cout << ” “; + space++; + for (c = 1 ; c <= 2*(n-k)-1; c++) + cout << “*”; + cout << endl; + } + return 0; +} diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern6.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern6.cpp new file mode 100644 index 00000000..5abcdc2c --- /dev/null +++ b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/patterns/pattern6.cpp @@ -0,0 +1,38 @@ +#include +using namespace std; +int main() +{ + int i, j, n=3; + for(i = 0; i < n; i++) + { + for(j = 0; j < (2 * n); j++) + { + if(i + j <= n - 1) + cout << "*"; + else + cout << " "; + if((i + n) <= j) + cout << "*"; + else + cout << " "; + } + cout << "\n"; + } + + for(i = 1; i < n; i++) + { + for(j = 0; j < (2 * n); j++) + { + if(i >= j) + cout << "*"; + else + cout << " "; + if(i >= (2 * n - 1) - j) + cout << "*"; + else + cout << " "; + } + cout << "\n"; + } +    return 0; +} From b8b080d0ba1a569915c31b38ebcb9bd30c8a11b6 Mon Sep 17 00:00:00 2001 From: Shubhipandey21 <103507502+Shubhipandey21@users.noreply.github.com> Date: Fri, 18 Nov 2022 08:28:29 +0530 Subject: [PATCH 6/6] 2D arrays --- .../{2Darray => 2D arrays}/2d array demo.cpp | 0 .../{2Darray => 2D arrays}/The state of wakanda 1.cpp | 0 .../{2Darray => 2D arrays}/matrixmultiplication.java | 0 .../{2Darray => 2D arrays}/spiral display.cpp | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/{2Darray => 2D arrays}/2d array demo.cpp (100%) rename AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/{2Darray => 2D arrays}/The state of wakanda 1.cpp (100%) rename AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/{2Darray => 2D arrays}/matrixmultiplication.java (100%) rename AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/{2Darray => 2D arrays}/spiral display.cpp (100%) diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/2d array demo.cpp similarity index 100% rename from AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/2d array demo.cpp rename to AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/2d array demo.cpp diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/The state of wakanda 1.cpp similarity index 100% rename from AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/The state of wakanda 1.cpp rename to AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/The state of wakanda 1.cpp diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/matrixmultiplication.java similarity index 100% rename from AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/matrixmultiplication.java rename to AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/matrixmultiplication.java diff --git a/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp b/AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/spiral display.cpp similarity index 100% rename from AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2Darray/spiral display.cpp rename to AR-VR/Shubhipandey21_ShubhiPandey_2125csit1169_2/2D arrays/spiral display.cpp