Skip to content

Commit 404088f

Browse files
ummm small changes etc etc.
1 parent d4b62cf commit 404088f

File tree

5 files changed

+189
-0
lines changed

5 files changed

+189
-0
lines changed

Diff for: .vscode/c_cpp_properties.json

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"${workspaceFolder}/**"
7+
],
8+
"defines": [
9+
"_DEBUG",
10+
"UNICODE",
11+
"_UNICODE"
12+
],
13+
"windowsSdkVersion": "10.0.22000.0",
14+
"cStandard": "c23",
15+
"cppStandard": "c++17",
16+
"compilerPath": "C:/MinGW/bin/g++.exe"
17+
}
18+
],
19+
"version": 4
20+
}

Diff for: .vscode/launch.json

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "(gdb) Bash on Windows Attach",
5+
"type": "cppdbg",
6+
"request": "attach",
7+
"program": "enter program name, for example ${workspaceFolder}/a.exe",
8+
"processId": "${command:pickRemoteProcess}",
9+
"pipeTransport": {
10+
"debuggerPath": "/usr/bin/gdb",
11+
"pipeProgram": "${env:windir}\\system32\\bash.exe",
12+
"pipeArgs": ["-c"],
13+
"pipeCwd": ""
14+
},
15+
"setupCommands": [
16+
{
17+
"description": "Enable pretty-printing for gdb",
18+
"text": "-enable-pretty-printing",
19+
"ignoreFailures": true
20+
},
21+
{
22+
"description": "Set Disassembly Flavor to Intel",
23+
"text": "-gdb-set disassembly-flavor intel",
24+
"ignoreFailures": true
25+
}
26+
]
27+
},
28+
29+
{
30+
"name": "C/C++: gcc.exe build and debug active file",
31+
"type": "cppdbg",
32+
"request": "launch",
33+
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
34+
"args": [],
35+
"stopAtEntry": false,
36+
"cwd": "${fileDirname}",
37+
"environment": [],
38+
"externalConsole": false,
39+
"MIMode": "gdb",
40+
"miDebuggerPath": "gdb.exe",
41+
"setupCommands": [
42+
{
43+
"description": "Enable pretty-printing for gdb",
44+
"text": "-enable-pretty-printing",
45+
"ignoreFailures": true
46+
},
47+
{
48+
"description": "Set Disassembly Flavor to Intel",
49+
"text": "-gdb-set disassembly-flavor intel",
50+
"ignoreFailures": true
51+
}
52+
],
53+
"preLaunchTask": "C/C++: gcc.exe build active file"
54+
}
55+
],
56+
"version": "2.0.0"
57+
}

Diff for: Assignments/.vscode/tasks.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"tasks": [
3+
{
4+
"type": "cppbuild",
5+
"label": "C/C++: gcc.exe build active file",
6+
"command": "C:\\msys64\\ucrt64\\bin\\gcc.exe",
7+
"args": [
8+
"-fdiagnostics-color=always",
9+
"-g",
10+
"${file}",
11+
"-o",
12+
"${fileDirname}\\${fileBasenameNoExtension}.exe"
13+
],
14+
"options": {
15+
"cwd": "${fileDirname}"
16+
},
17+
"problemMatcher": [
18+
"$gcc"
19+
],
20+
"group": {
21+
"kind": "build",
22+
"isDefault": true
23+
},
24+
"detail": "Task generated by Debugger."
25+
}
26+
],
27+
"version": "2.0.0"
28+
}

Diff for: Assignments/assignment_3_p2.c

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// assignment - 03 - problem 3 - print the transpose of matrix
2+
3+
#include <stdio.h>
4+
5+
// transpose krvane ke liye functions
6+
void transposeMatrix(int rows, int cols, int mat[rows][cols], int result[cols][rows]) {
7+
for (int i = 0; i < rows; i++) {
8+
for (int j = 0; j < cols; j++) {
9+
result[j][i] = mat[i][j];
10+
}
11+
}
12+
}
13+
14+
// matrix dikhane ke liye function
15+
void displayMatrix(int rows, int cols, int mat[rows][cols]) {
16+
for (int i = 0; i < rows; i++) {
17+
for (int j = 0; j < cols; j++) {
18+
printf("%d\t", mat[i][j]);
19+
}
20+
printf("\n");
21+
}
22+
}
23+
24+
int main() {
25+
int rows, cols;
26+
27+
// yaha humlog matrix ka size inpuit krva rahe hai like n x m wala
28+
printf("Enter the number of rows: ");
29+
scanf("%d", &rows);
30+
31+
printf("Enter the number of columns: ");
32+
scanf("%d", &cols);
33+
34+
int matrix[rows][cols];
35+
int result[cols][rows];
36+
37+
// yaha humlog matrix ke elements input krva rahe hai
38+
printf("Enter matrix elements:\n");
39+
for (int i = 0; i < rows; i++) {
40+
for (int j = 0; j < cols; j++) {
41+
printf("Enter element at position (%d, %d): ", i + 1, j + 1);
42+
scanf("%d", &matrix[i][j]);
43+
}
44+
}
45+
46+
// functions jo banaye they ups uski help se hum transpose wala operation krva ke dikhayenge
47+
transposeMatrix(rows, cols, matrix, result);
48+
49+
// yaha jo original ( jo humlog enter kiye they input me ) woh wala matrix dikhayenge
50+
printf("\nOriginal Matrix:\n");
51+
displayMatrix(rows, cols, matrix);
52+
53+
// yaha se matrix display krvayenge
54+
printf("\nTranspose of Matrix:\n");
55+
displayMatrix(cols, rows, result);
56+
57+
return 0;
58+
}

Diff for: Lab Files/Prime_num.c

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
int num;
6+
printf(" enter any number :");
7+
scanf("%d", &num);
8+
if (num == 0 || num == 1 || num < 0)
9+
{
10+
printf("Primes are not defined for negative / zero or 1");
11+
}
12+
for (int i = 2 ; i <= num/2 ; i++)
13+
{
14+
if (num % i != 0)
15+
{
16+
printf("The given number is prime");
17+
18+
19+
}
20+
else
21+
printf("The given number is not prime");
22+
i = i + 1;
23+
break;
24+
}
25+
return 0;
26+
}

0 commit comments

Comments
 (0)