From f773ed0ad9b3463569cf943ccf6e8f6254780697 Mon Sep 17 00:00:00 2001 From: Soumya3468 <126500318+Soumya3468@users.noreply.github.com> Date: Sun, 9 Apr 2023 00:36:42 +0530 Subject: [PATCH] Add files via upload --- .../Solutions/Soumyajit mallick/task 1/P1A1.c | 26 +++++++++++++++++ .../Solutions/Soumyajit mallick/task 1/P2A1.c | 19 ++++++++++++ .../Solutions/Soumyajit mallick/task 1/P3A1.c | 15 ++++++++++ .../Solutions/Soumyajit mallick/task 1/P4A1.c | 19 ++++++++++++ .../Solutions/Soumyajit mallick/task 1/P5A1.c | 24 +++++++++++++++ .../Solutions/Soumyajit mallick/task 1/Q1A1.c | 26 +++++++++++++++++ .../Solutions/Soumyajit mallick/task 1/Q2A1.c | 21 ++++++++++++++ .../Solutions/Soumyajit mallick/task 1/Q3A1.c | 16 ++++++++++ .../Solutions/Soumyajit mallick/task 1/Q4A1.c | 29 +++++++++++++++++++ .../Solutions/Soumyajit mallick/task 1/Q5A1.c | 18 ++++++++++++ 10 files changed, 213 insertions(+) create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/P1A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/P2A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/P3A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/P4A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/P5A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/Q1A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/Q2A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/Q3A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/Q4A1.c create mode 100644 Week1/Solutions/Soumyajit mallick/task 1/Q5A1.c diff --git a/Week1/Solutions/Soumyajit mallick/task 1/P1A1.c b/Week1/Solutions/Soumyajit mallick/task 1/P1A1.c new file mode 100644 index 0000000..1336a00 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/P1A1.c @@ -0,0 +1,26 @@ +#include + +int main() +{ + int year; + printf("Enter a year :"); + scanf("%d", &year); + if (year % 400 == 0) + { + printf("This is a leap year."); + } + else if (year % 100 == 0) + { + printf("This is not a leap year."); + } + else if (year % 4 == 0) + { + printf("This is a leap year."); + } + else + { + printf("This is not a leap year."); + } + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/P2A1.c b/Week1/Solutions/Soumyajit mallick/task 1/P2A1.c new file mode 100644 index 0000000..85d30b5 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/P2A1.c @@ -0,0 +1,19 @@ +#include + +int main() +{ + int m1, m2, m3, m4, m5; + int total; + float average, percentage; + printf("Enter five marks:\n"); + scanf("%d%d%d%d%d", &m1, &m2, &m3, &m4, &m5); + total = m1 + m2 + m3 + + m4 + m5; + average = (m1 + m2 + m3 + m4 + m5) / 5; + percentage = ((m1 + m2 + m3 + m4 + m5) / 500) * 100; + printf("total marks=%d\n", total); + printf("average marks=%f\n", average); + printf("percentage mark=%f\n", percentage); + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/P3A1.c b/Week1/Solutions/Soumyajit mallick/task 1/P3A1.c new file mode 100644 index 0000000..861d77e --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/P3A1.c @@ -0,0 +1,15 @@ +#include + +int main() +{ + float l; + float meter, kilometer; + printf("Enter length in cm :"); + scanf("%f", &l); + meter = l / 100; + kilometer = l / 1000; + printf("Length in meter=%f\n", meter); + printf("Length in kilometer=%f\n", kilometer); + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/P4A1.c b/Week1/Solutions/Soumyajit mallick/task 1/P4A1.c new file mode 100644 index 0000000..dce1e60 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/P4A1.c @@ -0,0 +1,19 @@ +#include + +int main() +{ + int a1, a2, a3, x; + printf("Input three angles:\n"); + scanf("%d%d%d", &a1, &a2, &a3); + x = a1 + a2 + a3; + + if (x == 180) + { + printf("Tringle is valid."); + } + else + { + printf("It is invalid."); + } + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/P5A1.c b/Week1/Solutions/Soumyajit mallick/task 1/P5A1.c new file mode 100644 index 0000000..bd6ed71 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/P5A1.c @@ -0,0 +1,24 @@ +#include + +int main() +{ + int l1,l2,l3; + printf("Enter three sides :\n"); + scanf("%d%d%d",&l1,&l2,&l3); + if(l1==l2&&l2==l3) + { + printf("Tringle is equilateral tringle"); + } + else if(l1==l2||l2==l3||l3==l1) + { + printf("It is isosceles tringle"); + } + + + else{ + printf("It is a scalene tringle"); + } + + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/Q1A1.c b/Week1/Solutions/Soumyajit mallick/task 1/Q1A1.c new file mode 100644 index 0000000..05e884a --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/Q1A1.c @@ -0,0 +1,26 @@ +#include + +int main() +{ + for (int i = 1; i <= 100; i++) + { + if ((i%3==0)&&(i%5==0)) + { + printf("Fizz Buzz\n"); + } + else if (i % 3 == 0) + { + printf("Fizz\n"); + } + else if (i % 5 == 0) + { + printf("Buzz\n"); + } + else + { + printf("%d\n", i); + } + + } + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/Q2A1.c b/Week1/Solutions/Soumyajit mallick/task 1/Q2A1.c new file mode 100644 index 0000000..9faf823 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/Q2A1.c @@ -0,0 +1,21 @@ +#include + +int main() +{ + int a; + printf("Enter a numer a ="); + scanf("%d",&a); + if(a>0) + + printf("It is a positive number."); + + else if(a==0) + + printf("It is zero."); + + else + +printf("It is a negative number."); + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/Q3A1.c b/Week1/Solutions/Soumyajit mallick/task 1/Q3A1.c new file mode 100644 index 0000000..b769a43 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/Q3A1.c @@ -0,0 +1,16 @@ +#include + +int main() +{ int a,r,q,sum; + printf("Enter a number :"); + scanf("%d",&a); + r=a%10; + q=a/10; + sum=r+q; + do + { + printf("%d",sum);break; + } while (q>0); + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/Q4A1.c b/Week1/Solutions/Soumyajit mallick/task 1/Q4A1.c new file mode 100644 index 0000000..897789b --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/Q4A1.c @@ -0,0 +1,29 @@ +#include + +int main() +{ + int a,b,c, sum, multiplication,division, substraction; + printf("Enter three numbers:\n"); + scanf("%d%d%d",&a,&b,&c); + switch(c) + { + case 1: + sum=a+b; + printf("%d",sum); + break; + case 2: + multiplication=a*b; + printf("%d",multiplication); + break; + case 3: + division=a/b; + printf("%d",division); + break; + case 4 : + substraction=a-b; + printf("%d",substraction); + break; + } + + return 0; +} \ No newline at end of file diff --git a/Week1/Solutions/Soumyajit mallick/task 1/Q5A1.c b/Week1/Solutions/Soumyajit mallick/task 1/Q5A1.c new file mode 100644 index 0000000..3bdccd9 --- /dev/null +++ b/Week1/Solutions/Soumyajit mallick/task 1/Q5A1.c @@ -0,0 +1,18 @@ +#include + +int main() +{ + int r, d; + float pi, c, a; + + printf("Enter radius :"); + scanf("%d", &r); + pi = 3.14; + d = 2 * r; + c = 2 * pi * r; + a = pi * r * r; + printf("\n%d", d); + printf("\n%f", c); + printf("\n%f", a); + return 0; +}