From 72993781e91b0337d0febe4046a73e69523e9328 Mon Sep 17 00:00:00 2001 From: AkshatFartade1 <166852853+AkshatFartade1@users.noreply.github.com> Date: Sat, 13 Apr 2024 15:20:47 +0530 Subject: [PATCH 1/2] added sol. --- .../Pull_Requests/Akshat_Fartade_DS_05/q1.c | 16 ++++++++++++++++ .../Pull_Requests/Akshat_Fartade_DS_05/q2.c | 18 ++++++++++++++++++ .../Pull_Requests/Akshat_Fartade_DS_05/q3.c | 0 3 files changed, 34 insertions(+) create mode 100644 2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c create mode 100644 2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c create mode 100644 2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q3.c diff --git a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c new file mode 100644 index 0000000..b8f05f4 --- /dev/null +++ b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c @@ -0,0 +1,16 @@ +#include +int main(){ + int n=3; + for(;n!=1;) + { + if(n%2==0){ + n/=2; + } + else + { + n=n*3+1; + }} + printf("The value of n is %d",n); + return 0; + +} \ No newline at end of file diff --git a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c new file mode 100644 index 0000000..45a3107 --- /dev/null +++ b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c @@ -0,0 +1,18 @@ +#include + +int main() { + int N, sum = 0; + + printf("Enter the value of n: "); + scanf("%d", &N); + + for (int i = 3; i < N; i++) { + if (i % 3 == 0 || i % 5 == 0) { + sum += i; + } + } + + printf("The sum is %d", sum); + + return 0; +} \ No newline at end of file diff --git a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q3.c b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q3.c new file mode 100644 index 0000000..e69de29 From 70cbc2e1c6b5cea7f6092caff9bdec8948bf5581 Mon Sep 17 00:00:00 2001 From: AkshatFartade1 <166852853+AkshatFartade1@users.noreply.github.com> Date: Sat, 13 Apr 2024 15:22:27 +0530 Subject: [PATCH 2/2] added minor changes --- 2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c | 3 ++- 2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c index b8f05f4..9d6fbc2 100644 --- a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c +++ b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q1.c @@ -1,5 +1,6 @@ #include -int main(){ +int main() +{ int n=3; for(;n!=1;) { diff --git a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c index 45a3107..0aa082d 100644 --- a/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c +++ b/2nd_sem/Pull_Requests/Akshat_Fartade_DS_05/q2.c @@ -1,6 +1,7 @@ #include -int main() { +int main() +{ int N, sum = 0; printf("Enter the value of n: ");