Find prime numbers from 1 to 100
First suggestion: do a search before posting, there are many very similar questions on codereview.
What the problem itself suggests is actually better than what you have, because it suggests you write a function to check if a number is prime, while you have everything patched together.
So, the first step is, split the code and write a function that is something like bool is_prime(int input_number)
Then, as said in the comments, you can stop at the square root of the number you're checking. 
You know that even numbers are not primes, so you can consider 2 the first prime, start the loop at 3 and increment by 2 instead of 1
Your code will print an extra blank space at the end
Just as an extra optimization, you can keep track of the primes that you've already found and use those to check, skipping what's in between, and continuing from there