I dont know whats wrong with my code. Basically I need to write a boolean function which take an interger as an arguement and returns true if the arguement is a prime number, and false otherwise and it prints out all the prime numbers between 0 and 100
Also, you're isPrime function does not do what one would expect.
I would expect it to return true or false if the passed number is prime. Instead it loops through all numbers and prints messages to the screen if they're prime.
jssmith has already answered your question however...
In addition to what has been said, you need to assign an integer value to the variable val which needs to be declared as well before calling the function. Also you are trying to do too much in your isPrime() function and too little in main(). Hint: print the message in main after returning true or false from isPrime()
We don't just give solutions to homework assignments. Fortunately your implementation is the second
most inefficient solution that I can think of (the first being looping on the condition i <= sqrt( val ),
forcing the evaluation of sqrt( val ) every time through the loop) so I don't think OP will be able to use
it.