Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int d,i;
- printf("podaj ilość elementów \n");
- scanf("%d",&d);
- float dod[20];
- float nied[20];
- float x;
- int q=0,w=0;
- for(i=0;i<d;i++){
- printf("podaj element numer %d z %d -",i+1,d);
- scanf("%f",&x);
- if(x>0) {dod[q]=x; q++;} else
- {
- nied[w]=x; w++;
- }
- }
- printf("tablica dodatnia \n");
- for (i=0;i<=q;i++){
- printf("%f \n",dod[i]);
- }
- printf("tablica niedodatnia \n");
- for(i=0;i<=w;i++){
- printf("%f \n",nied[i]);
- }
- x=0;
- for (i=0;i<q;i++)
- x=x+dod[i];
- for (i=0;i<w;i++)
- x=x+nied[i];
- printf("%f",x);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement