Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstdio>
- using namespace std;
- void zad1(){
- int a,b,mod=0;
- cout<<"Liczby podzielne przez 3:";
- do{
- ++a;
- if (a%3==0) cout<<a<<" ";
- }while(a!=30);
- getchar();getchar();
- }
- void zad2(){
- int a=0;
- do{
- ++a;
- cout<<a<<" - ";
- if (a%2==0) cout<<"parzysta\n";else cout <<"nieparzysta\n";
- }while(a!=20);
- getchar();getchar();
- }
- void zad3(){
- int a,licz,sum=0;
- float sr=0;
- a=1;
- while(a!=0){
- system("cls");
- cout<<"Podaj liczbe: ";cin>>a;
- if (a!=0){++licz;sum+=a;sr=sum/licz;}
- }
- cout << "Podales "<<licz<<" liczb\n";
- cout <<"Suma tych liczb wynosi: "<< sum<<endl;
- cout << "Srednia: "<<sr;
- getchar();getchar();
- }
- int main(){
- int wyb;
- do{
- system("cls");
- cin>>wyb;
- switch(wyb){
- case 1: zad1();break;
- case 2: zad2();break;
- case 3: zad3();break;
- }
- }while(wyb!=0);
- }
Advertisement
Add Comment
Please, Sign In to add comment