54
86
13
98
Avg: 62.75
Grade: D
64
92
67
85
Avg: 77.00
Grade: D
Program:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
long number,num1,num2;
int sum=0,i,arr[4];
double avg;
printf("Enter 8 digit number: ");
scanf("%ld",&number);
//code to get 4 pairs
num1=number/10000;
num2=number%10000;
i=0;
while(i<=3)
{
if(i==0)
{
arr[i]=num1/100;
}
else if(i==1)
{
arr[i]=num1%100;
}
else if(i==2)
{
arr[i]=num2/100;
}
else if(i==3)
{
arr[i]=num2%100;
}
i++;
}
printf("\n4 pairs of %ld number: \n\n",number);
for(i=0;i<=3;i++)
{
printf("%d\n",arr[i]);
sum=sum+arr[i]; //sum of all pairs
}
avg=(double) sum/4; //average
printf("\nAvg: %.2f",avg);
switch((int)avg/10) //getting grade
{
case 10:
case 9:
printf("\nGrade: A\n");
break;
case 8:
printf("\nGrade: B\n");
break;
case 7:
printf("\nGrade: C\n");
break;
case 6:
printf("\nGrade: D\n");
break;
default:
printf("\nGrade: F\n");
}
return 0;
}
Output:
Using Dev C++, write a program to solve the problem as stated below. Write a program...
Using Dev C++, write a program to solve the problem as stated below. Make use of a repetition structure (counter-controlled while loop) to shorten part of your code Dont use array. 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...
Write a program called printGPA. The program should contain at least 3 methods: main, gradeAverage, and letterGrade. The user will type a line of input containing the student's name, then a number that represents the number of scores, followed by that many integer scores (user input is in bold below). The data type used for the input should be one of the primitive integer data types. Here are two example dialogues: Enter a student record: Maria 5 72 91 84...
C++ 1. Write a program to check if two values are equal. The output should give the response "Both a and b are the same" or "a and b are not the same". 2. Write a program to take a test score and determine the grade A is 90-100, B is 80-89, C is 70-79, D is 60-69, F is 60 or below. BONUS - check for input validation (score over 100 or under 0)
how to solve this on c++?
Write a program that reads a five digits integer, then swaps the unit position digit with the ten thousandth position digit, also swap the tenth position digit with the thousandth position digit. Print the new number For example if the number is 37846 then the new number is 64873. Sample input / output: nter a five digits integer The new form of the number 37846 is 64873
[Using Python] Use the grade scale in the syllabus for this class, write a program that inputs a score, and prints the grade for that score. For example, if I input 90.0, your program should print A. Grading Scale is: 100% - 90% A 89% - 80% B 79% - 70% C 69% - 60% D 59% - 0% E
Write a C++ program that asks the user for an exam score. The program displays on the screen the appropriate later grade as per the schema below: a. A: [90-100] b. B: [80:89] c. C: [70:79] d. D: [60:69] e. F: otherwise
SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array....
i need this program in DEV C and starts with include stdio.h
only
Write a program that receives two input values: a float number x=0, and an integer N>3. The program should output Y, which is the product of all the N numbers divided by x.
Program : Write a complete C++ program that Input: Read a positive integer from the keyboard (user) with proper prompt text and save it to a variable. The integer have up to five digits. Processing: From the right most digit, extract every digit from the input integer using modular operator %then save the digit to a separate variable. Remove the right most digit from the integer using integer division operator /. Repeat above two steps till all digits have been...
Solve This Problem using python and please comment on every
line. also, use function to solve this.
thanks
The result will be like as below:
Write a program that asks the user to enter five test scores. The program should display a letter grade for each score and the average test score. Write the following functions in the program: This function should accept five test scores as arguments and return the average of the scores. This function should accept a...