Module Day 3
Module Day 3
Module Day 3
Question 1
Correct
Write a C program to find principle amount based on compound interest, time & rate of interest.
For example:
Input Result
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 }
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
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
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 }
200 -200 Maximum between 200 and -200 is 200 Maximum between 200 and -200 is 200
200 200021 Maximum between 200 and 200021 is 200021 Maximum between 200 and 200021 is 200021
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
For example:
Input Result
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 }
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
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
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 }
20 The number is not Odd Number The number is not Odd Number
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
For example:
Input Result
Correct
Marks for this submission: 2.00/2.00.
training.saveetha.in/mod/quiz/review.php?attempt=665798&cmid=2374 5/5