初来咋到、望老鸟指导、
// 输入一个1-4位整数、如果满足 a=i*i*i*i 等、即输出结果、若不满足则加以说明#include "stdio.h"
#include "windows.h"
void main()
{
int a,i,j;
printf ( "Please input a:" );
scanf ( "%d" , &a );
for ( i = 0 ; i < a ; i ++ )
{
if ( a == i * i )
{ printf (" a = %d * %d ",i,i );
Sleep(1000);
printf("\n");
for ( j = 0;j < a / 2;j ++ )
if ( i == j * j )
{
printf (" a == %d * %d * %d * %d ",j,j,j,j);
printf("\n");
Sleep(1000);
}
}
else
{
printf("无相同数相乘为a ");
Sleep(1000);
printf("\n");}
}
}
有办法只让最后一个if语句只判断一次么?我弄了很久都没头绪 。