Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- void main()
- {
- int suma, n, numimpar;
- do
- {
- cout << "Ingrese el valoir de n";cin >> n;
- } while (n<1);
- suma = 0;
- numimpar = 1;
- while (numimpar <= n)
- {
- suma = suma + numimpar;
- numimpar = numimpar + 2;
- }
- cout << "Suma=" << suma;
- _getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement