Problem: Read two integer values. After this, calculate the product between them and store the result in a variable named PROD . Print the result like the example below. Do not forget to print the end of line after the result, otherwise you will receive “Presentation Error” . Input The input file contains 2 integer numbers. Output Print PROD according to the following example, with a blank space before and after the equal signal. Solution: #include<stdio.h> int main() { int A,B,PROD; scanf("%d",&A); scanf("%d",&B); PROD=A*B; printf("PROD = %d\n",PROD); return 0; }
Problem Read four numbers (N 1 , N 2 , N 3 , N 4 ), which one with 1 digit after the decimal point, corresponding to 4 scores obtained by a student. Calculate the average with weights 2, 3, 4 e 1 respectively, for these 4 scores and print the message "Media: " (Average), followed by the calculated result. If the average was 7.0 or more, print the message "Aluno aprovado." (Approved Student). If the average was less than 5.0, print the message: "Aluno reprovado." (Reproved Student). If the average was between 5.0 and 6.9, including these, the program must print the message "Aluno em exame." (In exam student). In case of exam, read one more score. Print the message "Nota do exame: " (Exam score) followed by the typed score. Recalculate the average (sum the exam score with the previous calculated average and divide by 2) and print the message “Aluno aprovado.” (Approved student) in...
Problem: Read two floating points' values of double precision A and B, corresponding to two student's grades. After this, calculate the student's average, considering that grade A has weight 3.5 and B has weight 7.5. Each grade can be from zero to ten, always with one digit after the decimal point. Don’t forget to print the end of line after the result, otherwise you will receive “Presentation Error” . Don’t forget the space before and after the equal sign. Input The input file contains 2 floating points' values with one digit after the decimal point. Output Print MEDIA (average in Portuguese) according to the following example, with 5 digits after the decimal point and with a blank space before and after the equal signal. Solution: #include<stdio.h> int main() { double A,B,MEDIA; scanf("%lf",&A); scanf("%lf",&B); MEDIA=((A*3.5)+(B*7.5))/(3.5+7.5); printf("MEDIA = %0.5l...
Comments
Post a Comment