10/30/23, 10:38 AM M1-D3-L2-Operators & Expressions -Automata Coding-(Weekly Challenge)-SEB: Attempt review
Started on Friday, 27 October 2023, 11:48 AM
State Finished
Completed on Monday, 30 October 2023, 10:36 AM
Time taken 2 days 22 hours
Grade 10.00 out of 10.00 (100%)
Question 1
Correct
Mark 2.00 out of 2.00
Write a C program to find principle amount based on compound interest, time & rate of interest.
For example:
Input Result
3646.52 4 5 Principle Amount is = 3000.00
Answer: (penalty regime: 0 %)
Reset answer
1 #include <stdio.h>
2 #include<math.h>
3 int main()
4 ▼ {
5 float time,ri;
6 float amount,ci,principle;
7 scanf("%f%f%f",&amount,&time,&ri);
8 ri = ri*0.01;
9 //printf("%f",ri);
10 ci =pow((1 + ri), time);
11 //printf("%f",ci);
12
13 principle = amount / ci;
14
15
16 printf("Principle Amount is = %.2f",principle);
17 }
Input Expected Got
3646.52 4 5 Principle Amount is = 3000.00 Principle Amount is = 3000.00
Passed all tests!
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 1/5
10/30/23, 10:38 AM M1-D3-L2-Operators & Expressions -Automata Coding-(Weekly Challenge)-SEB: Attempt review
Question 2
Correct
Mark 2.00 out of 2.00
Write a C program to find the maximum number from the given values (for example: a=-200 , b=200 ) using conditional operators
(ternary operators).
For example:
Input Result
200 -200 Maximum between 200 and -200 is 200
Answer: (penalty regime: 0 %)
Reset answer
1 #include <stdio.h>
2 int main()
3 ▼ {
4 int a,b;
5 scanf("%d%d",&a,&b);
6 if((a>b)&&(a>0))
7 ▼ {
8 printf("Maximum between %d and %d is %d",a,b,a);
9 }
10 ▼ else{
11 printf("Maximum between %d and %d is %d",a,b,b);
12
13 }
14 }
Input Expected Got
200 -200 Maximum between 200 and -200 is 200 Maximum between 200 and -200 is 200
-10 0 Maximum between -10 and 0 is 0 Maximum between -10 and 0 is 0
200 200021 Maximum between 200 and 200021 is 200021 Maximum between 200 and 200021 is 200021
Passed all tests!
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 2/5
10/30/23, 10:38 AM M1-D3-L2-Operators & Expressions -Automata Coding-(Weekly Challenge)-SEB: Attempt review
Question 3
Correct
Mark 2.00 out of 2.00
Write a C program to calculate total, average and percentage of six subjects.
For example:
Input Result
98 87 76 65 77 98 Total marks = 501.00
Average marks = 83.50
Percentage = 83.50
Answer: (penalty regime: 0 %)
Reset answer
1 #include <stdio.h>
2 int main()
3 ▼ {
4 int a,b,c,d,e,f;
5 float tot,avg,per;
6 scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
7 tot=a+b+c+d+e+f;
8 avg=tot/6;
9 per=avg;
10 printf("Total marks = %.2f\n",tot);
11 printf("Average marks = %.2f\n",avg);
12 printf("Percentage = %.2f\n",per);
13
14 }
Input Expected Got
98 87 76 65 77 98 Total marks = 501.00 Total marks = 501.00
Average marks = 83.50 Average marks = 83.50
Percentage = 83.50 Percentage = 83.50
78 65 100 67 56 88 Total marks = 454.00 Total marks = 454.00
Average marks = 75.67 Average marks = 75.67
Percentage = 75.67 Percentage = 75.67
98 98 97 100 88 77 Total marks = 558.00 Total marks = 558.00
Average marks = 93.00 Average marks = 93.00
Percentage = 93.00 Percentage = 93.00
Passed all tests!
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 3/5
10/30/23, 10:38 AM M1-D3-L2-Operators & Expressions -Automata Coding-(Weekly Challenge)-SEB: Attempt review
Question 4
Correct
Mark 2.00 out of 2.00
Write a C program to check if the given number (For ex: 25) is an odd number or not using conditional operators.
For example:
Input Result
25 The number is Odd
20 The number is not Odd Number
Answer: (penalty regime: 0 %)
Reset answer
1 #include <stdio.h>
2 int main()
3 ▼ {
4 int n;
5 scanf("%d",&n);
6 if(n%2==0)
7 ▼ {
8 printf("The number is not Odd Number");
9 }
10 else
11 printf("The number is Odd");
12 }
Input Expected Got
25 The number is Odd The number is Odd
20 The number is not Odd Number The number is not Odd Number
Passed all tests!
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 4/5
10/30/23, 10:38 AM M1-D3-L2-Operators & Expressions -Automata Coding-(Weekly Challenge)-SEB: Attempt review
Question 5
Correct
Mark 2.00 out of 2.00
Write a C program to find area of a square.
For example:
Input Result
35 Area of Square : 1225.00
Answer: (penalty regime: 0 %)
1 #include<stdio.h>
2 int main()
3 ▼ {
4 float side;
5 float area;
6 scanf("%f",&side);
7 area=side*side;
8 printf("Area of Square : %.2f",area);
9 }
Input Expected Got
35 Area of Square : 1225.00 Area of Square : 1225.00
Passed all tests!
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 5/5