Documente Academic
Documente Profesional
Documente Cultură
ANSWER 3. C is a programming language. it was developed and written by dennis ritchie . it is mother
tounge of all programming languages .
FEATURES:
· it is very easy to learn.
· C is a fast speed language it takes much little time to exicute.
· operating systems like unix , linux , windows and gaming framework are written in c.
· C is a good base for learning C++ , C# or java etc.
ANSWER 4. when values are passed to the called function is known as call by value.
when addresses are passed to the called function is known as call by reference.
call by value:
· values of variables are passed.
· no pointer are used here.
· takes more time to exicute.
call by reference:
· addresses of variables are passed.
· pointers are used here.
· takes less time to exicute.
ANSWER 5. NO exit() and return() are not same to use because, exit() is a system call which terminates
current process.whereas, return() is a C language instruction and it returns from the current function.
ANSWER 6. #include<stdio.h>
int main()
{
int a;
while(a<=100)
{
printf("%d\n",a*a)
a++;
}
return 0;
}
ANSWER 7. if a loop exists inside the body of another loop,it's called nested loop.
EXAMPLE:
#include<stdio.h>
int main()
{
int a,b;
for(a=0;a<=1;a++)
{
for(b=0;b<=1;b++)
{
printf("%d %d\n",a,b);
}
}
return 0;
}
in this program , inner loop is exicuted 2 times for each value of a.when value of b exceeds 1 and reaches
2,next value of a is taken.
int main()
{
int n1,n2,i,gcd;
printf("enter two numbers");
scanf("%d%d",&n1,&n2);
for(i=1;i<=n1&&i<=n2;i++)
{
if(n1%i==0&&n2%i==0)
gcd=i;
}
printf("GCD of %d and %d is %d",n1,n2,gcd);
return 0;
}