Zad 1
#include <iostream>
using namespace std;
int main()
{
int tab[99],i,ile;
ile=0;
for (i=1; i<=100; i++) {
tab[i-1]=i;
if (i%2==1) ile=ile+1;
}
cout << "liczb nieparzystych jest: " << ile << endl;
return 0;
Zad 2
int tab[99],i,p,n;
p=0;
n=0;
if (i%2==1) n=n+i;
else p=p+i;
cout << "suma nieparzystych to: " << n << endl;
cout << "suma parzystych to: " << p << endl;
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
Zad 1
#include <iostream>
using namespace std;
int main()
{
int tab[99],i,ile;
ile=0;
for (i=1; i<=100; i++) {
tab[i-1]=i;
if (i%2==1) ile=ile+1;
}
cout << "liczb nieparzystych jest: " << ile << endl;
return 0;
}
Zad 2
#include <iostream>
using namespace std;
int main()
{
int tab[99],i,p,n;
p=0;
n=0;
for (i=1; i<=100; i++) {
tab[i-1]=i;
if (i%2==1) n=n+i;
else p=p+i;
}
cout << "suma nieparzystych to: " << n << endl;
cout << "suma parzystych to: " << p << endl;
return 0;
}