Write a C Code to find total marks from given input...
Write a C Code to find total marks from given input: Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam and find the grade using the following method:
- If Total mark >=80 then A+
- If Total mark >=70 then A
- If Total mark >=60 then A
- If Total mark >=50 then B
- Else Grade = F
Sample Input
Enter Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam: 2.5 7.5 3.5 7 21.5 33
Sample Output
Total Mark: 75 & Grade: A
Enter Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam: 2.5 7.5 3.5 7 21.5 33 Total Mark: 75.000000 & Grade: A
#include<stdio.h>
int main()
{
float attendance, ct, qt, assignment, mid_mark, final_mark, total_mark;
printf("Enter Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam: ");
scanf("%f %f %f %f %f %f", &attendance, &ct, &qt, &assignment, &mid_mark, &final_mark);
//Input: 2.5 7.5 3.5 7 21.5 33
total_mark = (attendance + ct + qt + assignment + mid_mark + final_mark);
if(total_mark >= 80 && total_mark <= 100)
{
printf("Total Mark: %f & Grade: A+\n\n", total_mark);
}
else if(total_mark >= 70 && total_mark <= 79)
{
printf("Total Mark: %f & Grade: A\n\n", total_mark);
}
else if(total_mark >= 60 && total_mark <= 69)
{
printf("Total Mark: %f & Grade: A-\n\n", total_mark);
}
else if(total_mark >= 50 && total_mark <= 59)
{
printf("Total Mark: %f & Grade: B\n\n", total_mark);
}
else
{
printf("Total Mark: %f & Grade: F\n\n", total_mark);
}
return 0;
}
Enter Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam: 2.5 7.5 3.5 7 21.5 33 Total Mark: 75.000000 & Grade: A
Write a C Code to calculate D = 𝒃^𝟐 − 𝟒𝐚𝐜 and...
Write a C Code to calculate D = 𝒃^𝟐 − 𝟒𝐚𝐜 and show the result according to following conditions:
a. D>0 then Calculate X1, X2. Where 𝒙𝟏 = (−𝒃+√𝒃^𝟐−𝟒𝒂𝒄)/𝟐𝒂 and 𝒙𝟐 = (−𝒃−√𝒃^𝟐−𝟒𝒂𝒄)/𝟐𝒂
b. D =0 then calculate X. Where 𝐱 = 𝒃^𝟐/𝟐𝒂
c. D<0 then print “No Solution”.
Sample Input
Enter a, b & c: 5 6 1
Sample Output
X1: -0.2
Enter a, b, & c: 5 6 1 X1: -0.200 x2: -1.000
#include<stdio.h>
#include<math.h>
int main()
{
float D, b, a, c, x, x1, x2;
printf("Enter a, b, & c: ");
scanf("%f %f %f", &a, &b, &c);
D = ((b*b) - 4*a*c);
if(D > 0)
{
x1 = (-b + sqrt(D))/(2*a);
x2 = (-b - sqrt(D))/(2*a);
printf("X1: %.3f\nx2: %.3f\n\n", x1, x2);
}
else if(D == 0)
{
x = (b*b)/(2*a);
printf("X: %f\n\n");
}
else if(D < 0)
{
printf("No Solution\n\n");
}
return 0;
}
Enter a, b, & c: 5 6 1 X1: -0.200 x2: -1.000
Write a C program to solve the Drake equation...
Write a C program to solve the Drake equation N = R*fp*ne*fl*fi*fc*L. Where R, ne and L must be discrete value.
Sample Input
Enter R, F(p), n(e), f(l), f(i), f(c), L: 5 0.25 20 0.2 0.15 0.11 150
Sample Output
The number of communicative civilizations within the Milky Way today: 12.375
Enter R, F(p), n(e), f(l), f(i), f(c): 5 0.25 20 0.2 0.15 0.11 150 The number of communicative civilizations within the Milky Way today: 12.375
#include<stdio.h>
#include<math.h>
int main()
{
float N, fp, fl, fi, fc;
int R, ne, L;
printf("Enter R, F(p), n(e), f(l), f(i), f(c): ");
scanf("%d %f %d %f %f %f %d", &R, &fp, &ne, &fl, &fi, &fc, &L); //Input: 5 0.25 20 0.2 0.15 0.11 150
float n = (float)R*ne*L;
N = n*fp*fl*fi*fc;
printf("The number of communicative civilizations within the Milky Way today: %.3f\n\n", N);
return 0;
}
Enter R, F(p), n(e), f(l), f(i), f(c): 5 0.25 20 0.2 0.15 0.11 150 The number of communicative civilizations within the Milky Way today: 12.375
Lab Task: MID TERM [20 Marks] | Assignment - June 2021
Sample Input
Enter R, F(p), n(e), f(l), f(i), f(c), L: 5 0.25 20 0.2 0.15 0.11 150
Sample Output
The number of communicative civilizations within the Milky Way today: 12.375
2. [7] Write a C Code to calculate D = 𝒃^𝟐 − 𝟒𝐚𝐜 and show the result according to following conditions:
a. D>0 then Calculate X1, X2. Where 𝒙𝟏 = (−𝒃+√𝒃^𝟐−𝟒𝒂𝒄)/𝟐𝒂 and 𝒙𝟐 = (−𝒃−√𝒃^𝟐−𝟒𝒂𝒄)/𝟐𝒂
b. D =0 then calculate X. Where 𝐱 = 𝒃^𝟐/𝟐𝒂
c. D<0 then print “No Solution”.
Sample Input
Enter a, b & c: 5 6 1
Sample Output
X1: -0.2
- If Total mark >=80 then A+
- If Total mark >=70 then A
- If Total mark >=60 then A
- If Total mark >=50 then B
- Else Grade = F
Sample Input
Enter Attendance, Class test, Quiz test, Assignment, Midterm and Final Exam: 2.5 7.5 3.5 7 21.5 33
Sample Output
Total Mark: 75 & Grade: A