Написать этому коду(ниже) блок-схему, метод(ход решения, можно кратко)
#include

using namespace std;

bool check(string &s){

for(auto &i : s)

if(!(i >= '0' && i <= '9'))

return false;

return true;

}

int sum_n(int k){

return (1 + k)*k/2;

}

signed main(){

string n;

cin >> n;

check(n) ? cout << sum_n(stoi(n)) : cout << "n is wrong";

}
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.