Source Code:
#include <stdio.h>
#include<stdlib.h>
int main(int argc, char const*argv[])
{
int i, n;
n=atoi(argv[1]);
for(i = 0; i <= n; i++)
{
if (n == i * i)
{
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
Output:
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 4
YES
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 5
NO
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 100
YES
Users Also Seen :
#include <stdio.h>
#include<stdlib.h>
int main(int argc, char const*argv[])
{
int i, n;
n=atoi(argv[1]);
for(i = 0; i <= n; i++)
{
if (n == i * i)
{
printf("YES");
return 0;
}
}
printf("NO");
return 0;
}
Output:
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 4
YES
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 5
NO
D:\D INSTALL\TDM-GCC-32\Programs>Perfect 100
YES
Users Also Seen :
- How to use Command Line arguments in C
- Add two numbers using Command Line Arguments in C
Thanks and regards,
Tech Bird
Comments