Program Discussion :: Basics
285 / 279
Write a program to print all the four digit numbers whose squares must have all the even digits.
Answer:
#include
#include
int main()
{
printf("the numbers are:\n");
for(int num=1000;num
Asked In ::
Language:
Navakishore
14 Dec, 2017 3:55 PM
#include <stdio.h>
#include <math.h>
int main()
{
printf("the numbers are:\n");
for(int num=1000;num<=9999;num )
{
int nroot=(int) sqrt(num);
if(num==nroot*nroot)
{
int upper=num/100;
int uroot=sqrt(upper);
if(upper==uroot*uroot)
{
int lower=num0;
int lroot=sqrt(lower);
if(lower==lroot*lroot)
printf("%d\n",num);
}
}
}
}
Language:
Kishore
14 Dec, 2017 3:58 PM
#include <stdio.h>
#include <math.h>
int main()
{
printf("the numbers are:\n");
for(int num=1000;num<=9999;num )
{
int nroot=(int) sqrt(num);
if(num==nroot*nroot)
{
int upper=num/100;
int uroot=sqrt(upper);
if(upper==uroot*uroot)
{
int lower=num0;
int lroot=sqrt(lower);
if(lower==lroot*lroot)
printf("%d\n",num);
}
}
}
}<span class="marker">​​​​​​​</span>