Professional Documents
Culture Documents
10
10
10
ROLL NO:16951A2172
YEAR: 2016-2017
SUBJECT: C PROGRAMMING
YEAR: I
SEMESTER : II
1. ALGORITHM:
3. Check the condition argc equal to 2 then printf the argv[1] value
4. Else if argc is greter than 2 the print Too many arguments supplied
6. Stop
PROGRAM:
1.#include<stdio.h>
#include<string.h>
int i;
printf("\n total no of arguments=5d",argc);
for(i=0;i<argc;i++)
printf("\n args[%d]=%s",i,argv[i]);
2.ALGORITHM:
2.To read two numbers at the command line and perform arithmetic operations
on it.
1. Start
3. If argc is equal to 3 then perform addition between the argv[1] and argv[2].
5. Stop
PROGRAM:
2.#include<stdio.h>
int sum=0;
if(argc<2)
return;
sum=atoi(argv[1])+atoi(argv[2]);
printf("\n sum=%d",sum);
getch();