54
86
13
98
Avg: 62.75
Grade: D
64
92
67
85
Avg: 77.00
Grade: D
Any Queries Comment Below
Happy Coding!!!
64
92
67
85
Avg: 77.00
Grade: D ( Wrong answer) it should be C because (D[69-60] C[70-79) as per the question
C++ Code:
__________________________________________________________________________________________________
#include <iostream>
using namespace std;
//Function to reverse the interger
int reverse(long int n)
{
long int r=0;
while(n!=0)
{
r = r*10+n%10;
n=n/10;
}
return r;
}
int main()
{
long int n,r=0,s=0,i=4,j;
float grade;
//reading input
std::cin >> n;
//reverseing the input
//54861398 into 98316845
r=reverse(n);
while(i!=0)
{
// r%100 == 45 and j ==54 for first time
j=reverse(r%100);
std::cout << j << std::endl;
s = s + j;
r = r/100;
i--;
}
//calculating average
grade = s/float(4);
//Displaying the aaverage value
printf("Avg: %.2f\n",grade);
//checking Grade base on the average and Displaying the
correspondence grade
if(grade>=90)
std::cout << "Grade: A" << std::endl;
else if (grade>=80 and grade<=89)
std::cout << "Grade: B" << std::endl;
else if (grade>=70 and grade<=79)
std::cout << "Grade: C" << std::endl;
else if(grade>=60 and grade<=69)
std::cout << "Grade: D" << std::endl;
else
std::cout << "Grade: F" << std::endl;
return 0;
}
___________________________________________________________________________
Using Dev C++, write a program to solve the problem as stated below. Make use of...
Using Dev C++, write a program to solve the problem as stated below. Write a program will input a single integer value (all input will be exactly 8 digits long) and will store pairs of digits as individual integer values. The program will display the five 2-digit numbers as well as the average of these, each on their own line. Use a switch statement to print out Grade: and then either A (>=90), B ([80..89]), C ([70..79]), D ([60..69]) or...
In basic c develop the code below: (a) You will write a program that will do the following: prompt the user enter characters from the keyboard, you will read the characters until reading the letter ‘X’ You will compute statistics concerning the type of characters entered. In this lab we will use a while loop. We will read characters from stdin until we read the character ‘X’. Example input mJ0*5/]+x1@3qcxX The ‘X’ should not be included when computing the statistics...
C program. Using do-while loop for this question. Question: write a program to calculate the average of first n numbers. output: Enter the value of n : 18 The sum of first 18 numbers =171 The average of first 18 numbers = 9.00 my code couldn't give me the right avg and sum. Please help. #include<stdio.h> int main() { int num; int count =0; int sum=0; float avg; printf("Enter the value of n: "); ...
C++ Redo PROG8, a previous program using functions and/or arrays. Complete as many levels as you can. Level 1: (20 points) Write FUNCTIONS for each of the following: a) Validate #students, #scores. b) Compute letter grade based on average. c) Display student letter grade. d) Display course average. Level 2: (15 points) Use ARRAYS for each of the following. e) Read a student's scores into array. f) Calculate the student's average based on scores in array. g) Display the student's...
Please use python to write the simple program.
Exercise 2 - Summation Write a program to accept integer inputs until the user inputs a non-integer. Then, the program prints the summation of the inputted numbers. Hint: Use the function input() to get the user input. Use a variable total for calculating the summation. Need to use while loop for the repeated inputs. Use if statement with isdigit() function to check whether the user input is an integer or not. if...
In C please! 4.20 LAB: Countdown until matching digits Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical. Ex: If the input is: 93 the output is: 93 92 91 90 89 88 Ex: If the input is: 77 the output is: 77 Ex: If the input is: 15 or any number not between 20 and 98 (inclusive),...
Objectives:
Use the while loop in a program
Use the do-while loop in a second program
Use the for loop in a third program
Instructions:
Part A. Code a for loop to print the Celsius temperatures for
Fahrenheit temperatures 25 to 125. C = 5/9(F – 32).Output should be
in a table format:
Fahrenheit Celsius
25 ?
. .
. . . .
. .
Turn in the source and the output from Part A.
Part B. Code a while...
Use your knowledge of algorithm development to create a program using RAPTOR to solve the problem below. Input a list of student names (in to array student[]) and testing scores stored in parallel arrays. Each student have 3 testing scores ranging from 0 to 100 (store into parallel array score1[], score2[], score3[]). Output average score for each student and print out what is his final grade. If average score <60, got F grade. If 60<=average score<70, got D grade. If...
Use Dev C++ for program and include all of the following. Im
lost.
Make sure the user enters a letter of R, P, or S and the
computer generates a number between 0-2 and changes that number to
a letter of R, P or S, using a switch. Make sure the user knows why
he/she has won or lost – print a message like “Paper covers Rock”
or “Scissors cuts Paper”.
Ask the user how many times he/she wants to...
Write a program that prompts the user to input daily rainfalls and display the total and average rainfall. Use a sentinel controlled loop with sentinel value of -1. Your output values should only have three digits after the decimal point. Test your program with following input data. 0.31 0.0 0.52 0.79 1.15 1.23 0.93 0.0 0.0 -1 The output of the program should be: The total rainfall is : 4.930 The average rainfall is : 0.547 Copy and paste your...