How to run a program in Turbo C explained with the example
Program:
Step1: Type the program and save with the name “Even1.c”
#include<stdio.h>
int main(int argc, char *argv[])
{
if(argc!=2)
exit(1);
if(atoi(argv[1])%2==0)
printf("\nEVEN NUMBER\n");
return 0;
}
Step2: Compile the program by pressing F9
Then it will start linking
Step3: Go to the command prompt (OS shell) by selecting file – DOS/OS Shell
Step4: Pass command line arguments while executing the program
Program:
Step1: Type the program and save with the name “Even1.c”
#include<stdio.h>
int main(int argc, char *argv[])
{
if(argc!=2)
exit(1);
if(atoi(argv[1])%2==0)
printf("\nEVEN NUMBER\n");
return 0;
}
Step2: Compile the program by pressing F9
Then it will start linking
Step3: Go to the command prompt (OS shell) by selecting file – DOS/OS Shell
Step4: Pass command line arguments while executing the program
8 Comments
I am not been able to run this program on turboc++
ReplyDeletewhich error u r facing ?
DeleteAre you following all steps correctly??
ReplyDeletei am not been able to run this program i follow the above steps
ReplyDeleteIt's working. I have checked it lots of time but still if u are facing problem u cam also check in codeblocks. Its much more easier.
DeleteDuring tcs test where we are going to write the command line program and how we are going to execute that.
DeleteDuring TCS Test, You will have to write and execute Your program on TCS's own Compiler. In that compiler you have space to write your code and click on compile/execute. after that it will show you message like"your program has passed test cases".
ReplyDeletewhen i execute this code in turbo c i'm not getting the output desired.if i enter 5 it displays as "illegal command 5".what can we do?
ReplyDelete