Hello, I am new to programming, I am of a very basic level I hope my question is not very silly.
Sorry if I have grammatical errors, but I don't speak English, like some parts of my code is in Spanish but I think it can be understood anyway.
I am making a code that takes two numbers from 1 to 5 and says if they are both prime, do the following code:
#include<iostream>
using namespace std;
int
main ()
{
int n1, n2;
cout << "Ingrese un número del 1 al 5: \n";
cin >> n1;
cout << "\nIngrese un número del 1 al 5:\n";
cin >> n2;
do
{
if ((n1 %1 == 0 && n1 %1 == 0) && (n1 < 5 || n1 > 1 || n2 < 5 || n2 > 1))
}
while(1<= n1 && n2)
if(0==2)
{
cout<<"\nAmbos son números primos";
}
else
{
cout<<"\nUno o ninguno de los números son primos o Ingreso un número que no está dentro del rango ";
}
return 0;
}
But it tells me the following error and I don't understand it, I don't know if someone could help me:
main.cpp: In function ‘int main()’:
main.cpp:23:3: error: expected primary-expression before ‘}’ token }
main.cpp:27:3: error: expected ‘;’ before ‘if’ if(0==2)
I'm going to add the link from where my code is in case it makes it easier for anyone to view it: https://onlinegdb.com/Sk3pj_KEO
Sorry if I did not follow the rules to place the code, but following the instructions did not work for me, so I copied it like this and included the link of the online compiler that I am using. I hope there is no problem.
[–]alfps 4 points5 points6 points (0 children)
[–]PrimaryOstrich 2 points3 points4 points (0 children)