Command line argument
How to execute command line arguments program either in c or Java
2 Answers
4 years ago by Dr. M Jayaram
Hello Dr.M Jayaram,
Currently we do not support command line arguments, we only support scanner.
Following are some example programs using scanner
Java: https://onecompiler.com/java/3wxy4z4b5
C: https://onecompiler.com/c/3wxy538hw
4 years ago by OneCompiler
class Primeno
{
void prime(int n)
{
int d=2;
while(d<n)
{
if (n%d==0)
break;
else
d++;
}
if(d==n)
System.out.println(n+"is Prime");
}
public static void main(String args[])
{
Primeno p=new Primeno();
int no=Integer.parseInt(args[0]);
int i,j;
for(i=1;i<=no;i++)
{
p.prime(i);
}
}
}
5 months ago by HARSHADA NAMDEO JADHAV 4418889