need some lights about a task

Hi everybody, I'm a beginner at c++ programming and I wanted to know if someone can help me for some task that I have to do.

I want to create a c++ code where users enters 2 natural numbers n and m, and print out all numbers located in interval [n,m] and being the sum of two squared natural numbers (using a function that recognizes if a number is squared).

I've only tried to write down a code to verify if a number is squared.


#include <iostream>
#include<string>
#include<stdio.h>

using namespace std;

int main()
{
int a, n;
printf("Enter a number: ");
scanf("%d", &n);
for(a = 0; a <= n; a++)
{
if (n == a * a)
{
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
Topic archived. No new replies allowed.