Home
О нас
Products
Services
Регистрация
Войти
Поиск
khkhara
@khkhara
July 2022
2
9
Report
Язык программирования Си
Дана последовательность a1,a2,..an вещественных чисел. Найти сумму всех элементов, больших заданного числа b
Please enter comments
Please enter your name.
Please enter the correct email address.
Agree to
terms of service
You must agree before submitting.
Send
Answers & Comments
BrightOne
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n=10;
int max = 20, min = 10;
float a[n];
float b;
float sum=0;
srand (time(NULL));
for (int i=0; i<n; i++) {
a[i] = (float) rand() / RAND_MAX*(max-min)+min;
printf ("%.2f ", a[i]);
}
printf("\n");
printf("b = ");
scanf("%f",&b);
for (int i = 0; i<n; i++) {
if (a[i] > b) sum+=a[i];
}
printf("sum = %.2f\n", sum);
return 0;
}
Пример:
11.93 14.67 18.25 13.99 14.33 11.68 15.80 17.83 13.61 18.20
b = 15
sum = 70.08
2 votes
Thanks 2
petyaGavrikov
Verified answer
#include <stdio.h>
int main()
{
float a, b, sum = 0;
int n;
printf("n = ");
scanf("%d", &n);
printf("b = ");
scanf("%f", &b);
for (int i = 1; i <= n; i++)
{
printf("a%d = ", i);
scanf("%f", &a);
if (a > b)
{
sum += a;
}
}
printf("\nОтвет: %.2f", sum);
return 0;
}
0 votes
Thanks 0
More Questions From This User
See All
khkhara
August 2022 | 0 Ответы
c dan tekstovyj fajl soderzhashij svedeniya o pacientah glaznoj kliniki kazhdaya s
Answer
khkhara
August 2022 | 0 Ответы
napisat programmu na yazyke sidano chislo h v 10 sisteme schisleniya perevesti eg
Answer
khkhara
August 2022 | 0 Ответы
3)...
Answer
khkhara
July 2022 | 0 Ответы
lnodu linejnoe neodnorodnoe differencialnoe uravnenie y y 2ysin2x
Answer
khkhara
July 2022 | 0 Ответы
d...
Answer
khkhara
July 2022 | 0 Ответы
yazyk programmirovaniya s si sostavit programmu analiziruyushuyu nazhatuyu knopku n
Answer
khkhara
July 2022 | 0 Ответы
napishite programmu na yazyke c dan fajl f komponenty kotorogo yavlyayutsya celymi ch
Answer
khkhara
July 2022 | 0 Ответы
osnovanie pryamougolnogo parallelepipeda kvadrat najti obes etogo parallelepip
Answer
khkhara
July 2022 | 0 Ответы
ploshad osnovaniya pravilnoj chetyrehugolnoj piramidy 36 a ee bokovaya poverhnos
Answer
khkhara
July 2022 | 0 Ответы
v osnovanii prizmy lezhit ravnostoronnij treugolnik ploshad kotorogo ravna 9sqr
Answer
рекомендуемые вопросы
rarrrrrrrr
August 2022 | 0 Ответы
o chem dolzhny pozabotitsya v pervuyu ochered vzroslye pri organizacionnom vyvoze n
danilarsentev
August 2022 | 0 Ответы
est dva stanka na kotoryh vypuskayut odinakovye zapchasti odin proizvodit a zapcha
myachina8
August 2022 | 0 Ответы
najti po grafiku otnoshenie v3v1 v otvetah napisano 9 no nuzhno reshenie
ydpmn7cn6w
August 2022 | 0 Ответы
Choose the correct preposition: 1.I am fond (out,of,from) literature. 2.where ar...
millermilena658
August 2022 | 0 Ответы
opredelite kak sozdavalas i kto sozdaval arabskoe gosudarstvo v kracii
MrZooM222
August 2022 | 0 Ответы
ch ajtmanov v rasskaze krasnoe yabloko ispolzuet metod rasskaz v rasskaze opi
timobila47
August 2022 | 0 Ответы
kakovo bylo naznachenie kazhdoj iz chastej vizantijskogo hrama pomogite pozhalujsta
ivanyyaremkiv
August 2022 | 0 Ответы
moment. 6....
pozhalujsta8b98a56c0152a07b8f4cbcd89aa2f01e 97513
sarvinozwakirjanova
August 2022 | 0 Ответы
pomogite pozhalusto pzha519d7eb8246a08ab0df06cc59e9dedb 6631
×
Report "Язык программирования Си Дана последовательность a1,a2,..an вещественных чисел. ..."
Your name
Email
Reason
-Select Reason-
Pornographic
Defamatory
Illegal/Unlawful
Spam
Other Terms Of Service Violation
File a copyright complaint
Description
Helpful Links
О нас
Политика конфиденциальности
Правила и условия
Copyright
Контакты
Helpful Social
Get monthly updates
Submit
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <stdlib.h>
int main()
{
int n=10;
int max = 20, min = 10;
float a[n];
float b;
float sum=0;
srand (time(NULL));
for (int i=0; i<n; i++) {
a[i] = (float) rand() / RAND_MAX*(max-min)+min;
printf ("%.2f ", a[i]);
}
printf("\n");
printf("b = ");
scanf("%f",&b);
for (int i = 0; i<n; i++) {
if (a[i] > b) sum+=a[i];
}
printf("sum = %.2f\n", sum);
return 0;
}
Пример:
11.93 14.67 18.25 13.99 14.33 11.68 15.80 17.83 13.61 18.20
b = 15
sum = 70.08
Verified answer
#include <stdio.h>int main()
{
float a, b, sum = 0;
int n;
printf("n = ");
scanf("%d", &n);
printf("b = ");
scanf("%f", &b);
for (int i = 1; i <= n; i++)
{
printf("a%d = ", i);
scanf("%f", &a);
if (a > b)
{
sum += a;
}
}
printf("\nОтвет: %.2f", sum);
return 0;
}