From f5a48f2351bea2674e1da7652a7799726f49f9e5 Mon Sep 17 00:00:00 2001 From: RossTheRoss Date: Thu, 14 Feb 2019 21:11:31 +0000 Subject: Simplify things --- misc/test.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'misc') diff --git a/misc/test.cpp b/misc/test.cpp index 40e15c5..109925d 100644 --- a/misc/test.cpp +++ b/misc/test.cpp @@ -7,16 +7,17 @@ int main () { cout << "Enter a number:"; cin >> x; for (i=x; i>1; --i) - { if (x%i==0 && x!=i) { - cout << "Not prime!" << endl; + cout << x << " is not prime!" << endl; + cout << "Divisible by " << i << "." << endl << endl; a=1; break; - return i; } + } } - if (!a) - cout << "Prime!" << endl; + if (!a){ + cout << x << " is a prime number!" << endl << endl; return 0; -} + } +} \ No newline at end of file -- cgit v1.2.3