Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #include <conio.h>
- int main()
- {
- BatDau:
- int n;
- cout << "\nNhap n: "; cin >> n;
- int S = 0;
- for(int i = 1; i <= n; ++i)
- {
- S += i;
- }
- cout << "KQ = " << S;
- cout << "\nNhap y de kiem tra lai:";
- char y = getch();
- if(y == 'Y' || y == 'y')
- {
- system("cls");
- goto BatDau;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement