Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <locale.h>
- int main()
- {
- setlocale (LC_ALL, "rus");
- int x,n=0;
- float sum=1,mul=1;
- printf("Введите числа, признак конца ввода — 0:");
- do
- {
- scanf("%d",&x);
- n += 1;
- if(x>0)
- sum+=x;
- if(n%2!=0)
- mul*=x;
- }while (x!=0);
- printf("Сумма положительных: %.2f",sum);
- printf("Произведение нечётных: %.2f",sum);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement