Reverse a Number using Command Line Argument
C Programming Language Command Line Arguments (Article) Command Line Arguments (Program)
3130Program:
#include #include int main(int argc, char *argv[]) { if(argc==1) { printf("No Arguments"); return 0; } else { int n,reverseNumber,temp,rem; n=atoi(argv[1]); temp=n; reverseNumber=0; while(temp) { rem=temp%10; reverseNumber=reverseNumber*10+rem; temp=temp/10; } printf("%d",reverseNumber); return 0; } }
Output:
123 321
Explanation:
no
This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.