iwan90 - 2011-03-02 20:02:14 |
#include <iostream> #include <conio.h> #include <cmath> using namespace std; int main() { int a; cout<<"Podaj liczbe: ",cin>>a; if (a%2==0) cout<<"Liczba "<<a<<" jest parzysta."; else cout<<"Liczba "<<a<<" jest nieparzysta."; cin.ignore(); getch(); return 0; }
|
iwan90 - 2011-03-02 20:03:31 |
#include <iostream> #include <conio.h> #include <math.h> using namespace std; int main() { int a, suma; suma=0; while (a!=0) { cout<<"Podaj liczbe: ",cin>>a; suma=suma+a; } cout<<"Suma licz wynosi: "<<suma; cin.ignore(); getch(); return 0; }
|
iwan90 - 2011-03-02 20:05:09 |
#include <iostream> #include <conio.h> #include <math.h> using namespace std; int main() { int a, suma; suma=0; while (a!=0) { cout<<"Podaj liczbe: ",cin>>a; suma=suma+a; } cout<<"Suma licz wynosi: "<<suma; cin.ignore(); getch(); return 0; }
|
iwan90 - 2011-03-02 20:06:17 |
Potrzeby mi 2 i piąty program.
|
empi - 2011-03-03 08:49:52 |
lap drugi:
int main(int argc, char* argv[]) { int a,b,c; cout<<"podaj a: "; cin>>a; cout<<"podaj b: "; cin>>b; cout<<"podaj c: "; cin>>c;
if((a<b)&&(a<c)) { cout<<a<<", "; if(b<c) cout<<b<<", "<<c; else cout<<c<<", "<<b; } else
if((b<a)&&(b<c)) { cout<<b<<", "; if(a<c) cout<<a<<", "<<c; else cout<<c<<", "<<a; } if((c<a)&&(c<b)) { cout<<c<<", "; if(a<b) cout<<a<<", "<<b; else cout<<b<<", "<<a; } getch(); return 0; }
|
luki-90 - 2011-03-03 11:13:38 |
Ma ktoś może 5 zadanie ?
|
lukmas3 - 2011-03-03 18:47:41 |
Zadanie 5. Wczytac liczby n oraz m i wypisac m-ta cyfre liczby n.
#include <cstdlib> #include <iostream> using namespace std; int main(int argc, char *argv[]) { int n, m, x, t, s, v; cout<<"Podaj liczbe n"<<endl; cin>>n; cout<<"Podaj liczbe m"<<endl; cin>>m; v=n; s=0; while(v>0){ v=v/10; s++;} //sprawdzam ile cyfr ma liczba n t=(s-m)+1; if(t>0){ while((n>0)&&(t>0)){ x=n%10; n=n/10; t--; } cout<<"Twoja m-ta cyfra liczby n to "<<x<<endl; } else cout<<"ERROR, zadasz cyfre z liczby o wiekszej liczbie cyfer niz podales, popraw to!"<<endl; system("PAUSE"); return EXIT_SUCCESS; }
tylko pozmieniajcie chociaz zmienne bo meczyłem się nad tym troche:D
|