Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n=0; // musu n skaicius
- int sum=0; // galutinis atsakymas
- cout<<"N nuo 1 iki 15. Iveskite n skaicio reiksme: ";
- cin>>n;
- if(n>15 || n<1){cout<<"Netinkama n reiksme!"<<endl;}
- else{
- while(n>=1)
- {
- sum+=n*n;
- n=n-1;
- }
- cout<<"Atsakymas: "<<sum<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment