Answer the question
In order to leave comments, you need to log in
How to translate from C++ to PascalABC?
#include
#include
using namespace std;
int main()
{
int n, i, t, t1;
cout<<"n="; cin>>n;
for(i=2; i<=(int)sqrt((double)n); i++)
{
t=0; t1=n;
while(t1%i==0)
{
t++;
t1/=i;
}
if(t==2)
cout< }
return 0;
}
Answer the question
In order to leave comments, you need to log in
Wow! I last wrote in Pascal ~24 years ago :) (and it was then Tetris, because there was nothing to do)
1. replace {...} with begin ... end
2. replace the for(...) loop with a while loop ... do
3. replace = with :=
4. replace == with =
5. no /= operator, replace with t1=t1 div i;
6. there is no ++ operator, let's replace it with t:=t+1;
7. replace t1%i with t1 mod i
8. replace cout, cin with write(...), read(...)
9. it remains to declare variables correctly and write begin instead of int main(){...} . ..end. (with a dot at the end)
Something like that.
https://ru.wikipedia.org/wiki/Pascal_(program_language...
PS Well, something is missing in C++:
#include
#include
cout< }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question