Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /* run this program using the console pauser or add your own getch, system("pause") or input loop */
- void suma() {
- int a=0, b=0, c=0;
- cout<<"Podaj sumę liczb: ";
- cin>>a;
- for(int i=0;i<a;i++){
- b=b+1;
- c=c+b;
- cout<<b<<endl;
- }
- cout<<"Razem: "<<c;
- }
- void sl() {
- int a=0, b=0, c=1;
- cout<<"Podaj sumę liczb: ";
- cin>>a;
- for(int i=0;i<a;i++){
- b=b+1;
- c=c*b;
- cout<<b<<endl;
- }
- cout<<"Razem: "<<c;
- }
- main() {
- char w;
- cout<<"Suma a | silnia b | ";
- cin>>w;
- switch(w) {
- case 'a': {
- suma();
- break;
- }
- case 'b': {
- sl();
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement