#include<iostream>
usingnamespace std;
int main(){
int a, b, c,d ;
cin>>a>>b;
c=2;
d=2;
while(c>a){
if(a%c==0)
cout<<a<<" is not prime\n";
c++;
}
if(c>a)
cout<<a<<" is prime\n";
while(d>b){
if(b%d==0)
cout<<a<<" is not prime\n";
d++;
}
if(d>b)
cout<<b<<" is prime\n";
return 0;
}
Aside from the comment you received, I would like to give you the advice to use more detailed variables and use more space to write out the various operations. (For instance; I would personally name 'a' 'UI_number' (user input number).)
While this might indeed mean that you are taking up more space to write the same code, it has the advantage of clarity. From one beginning programmer to another; Readability far exceeds minimizing the length of the code.
I suggest that you re-write your own program with Ajuzoo's example next to it, step by step, so that you can better see what you are doing.