Armstrong Number Using Command Line Argument

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

#include<stdio.

h>

#include<stdlib.h>

int main(int argc , char *argv[]){

int rem,result=0,val;

val=atoi(argv[1]);

int number = val;

if(argc==0){

return 0;

else{

while(val!=0){

rem=val%10;

result=result+rem*rem*rem;

val=val/10;

if(number==result){

printf("armstrong number");

else{

printf("not armstrong number");

return 0;

You might also like