yes we can write inside the main function.That is we can pass formal arguments inside the main function in c.we can declare any variable inside the main function which is same as declaring the variable inside the block of the main function. lets have a look on the program given below:
#include <stdlib.h>
int main(int a,int b)
{
int c;
printf("\"enter the two numbers\"");
scanf("%d%d",&a,&b);
c=a+b;
printf("the sum of %d and %d is %d",a,b,c);
getchar();
return 0;
}
Program:-
#include <stdio.h>#include <stdlib.h>
int main(int a,int b)
{
int c;
printf("\"enter the two numbers\"");
scanf("%d%d",&a,&b);
c=a+b;
printf("the sum of %d and %d is %d",a,b,c);
getchar();
return 0;
}
Have A Try:-
Can we Store Something in the void Data Type.If no then what is the purpose of using void as a modifier or a data type in "C Programming" languages.put your answer in the form of the comment.
you many also contact us at contact us
Email:- admin@allaboutcomputing.net
0 comments:
Post a Comment