Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int i=1;
- while(i<=10) {
- cout<<i<<" ";
- i = i+1;
- }
- return 0;
- }
- -------------------------------------------------------------------------------------
- #include <iostream>
- using namespace std;
- int main() {
- int i=1, suma=0;
- while(i<=10) {
- i = i+1;
- suma = suma + i;
- }
- cout<<suma;
- return 0;
- }
- -------------------------------------------------------------------------------------
- #include <iostream>
- using namespace std;
- int main() {
- int i=1, j=2, suma=0;
- while(i<=10) { // lub i<=11
- suma = suma + j;
- j = j+2;
- i = i+1;
- }
- cout<<suma;
- return 0;
- }
- -------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement