chap 4 notes 88 - true ) cout<< "The number...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
88 #include <iostream> using namespace std; int main( void ){ int n; cout<< "Enter a number: " ; cin>>n; int i; bool prime= true ; for (i= 2 ; i< n; i++){ if (n%i== 0 )prime= false ; } cout<< endl << endl; if (prime==
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: true ) cout<< "The number " << n << " is prime." ; else cout<< "The number " << n << " is not prime." ; return ; } A Prime Example, Part 2 n i prime 7 3 true...
View Full Document

This note was uploaded on 11/16/2011 for the course COP 2271 taught by Professor Staff during the Fall '11 term at University of Florida.

Ask a homework question - tutors are online