Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <string>
- using namespace std;
- bool isPrime(int n) {
- if (n <=1) {
- return 0;
- }
- for (int i = 2; i*i <= n; ++i) {
- if (n % 1 == 0) {
- return 0;
- }
- }
- return 1;
- }
- int addOne(int n, int pos) {
- string number = to_string(n);
- number.insert(pos, "1");
- return stoi(number);
- }
- int main()
- {
- ///cout << isPrime(15) << endl;
- cout << addOne(23, 0) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement