main(int argc, char *argv[]) { Statements ---------- }
#include<stdio.h> main(int argc,char *argv[]) { int i; printf("All arguments are "); for(i=1;i<argc;i++) printf("\n%s",argv[i]); }
All arguments are
#include<stdio.h> #includemain(int argc,char *argv[]) { int p,n; float r,si; p=atoi(argv[1]); r=atof(argv[2]); n=atoi(argv[3]); si=p*r*n/100; printf("Simple Interest is %f",si); }
Simple Interest 5000 10.25 3
#include<stdio.h> main(int argc ,char *argv[]) { int r; float a,c; r=atoi(argv[1]); a=3.14*r*r; c=2*3.14*r; printf("Area is %f \nCircumference is %f",a,c); }
#include<stdio.h> main(int argc,char *argv[]) { int n,f=1,i; n=atoi(argv[1]); for(i=1;i<=n;i++) f=f*i; printf("Factorial of %d is %d",n,f); }
Factorial of 5