Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*#include <iostream>
- using namespace std;
- int main(){
- setlocale(LC_ALL, "Russian");
- int n;
- int fact = 1;
- cout << "Введите факториал: " ;
- cin >> n;
- for(int i = 1; i <=n; ++i){
- fact *= i;
- }
- cout << "Factorial = " <<fact ;
- return 0;
- }*/
- #include <iostream>
- using namespace std;
- int main() {
- double A;
- int S{0}, counter{1};
- cout << "Enter number: ";
- cin >> A;
- do
- {
- S += counter;
- counter++;
- } while (A > S);
- cout << S << '\n';
- counter = 1;
- S = 0;
- while (A > S)
- {
- S += counter;
- counter++;
- }
- cout << S << '\n';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement