Sie sind auf Seite 1von 3

NAME: MOHD FAIZ

ROLL NO: 1902051043


CE 2nd SEM
PROGRAMMING IN C

ANSWER 1. (A) C has only 32 keywords.


(B) main() is the function in which whole C program is written inside curley braces.
(C) there are four types of file in C:
(1.) text files
(2.) binary files
(3.) object files
(4.) header files
(D) the range for integer data type is -2147483648 to +2147483647 .
(E.) C language was devoloped by dennis ritchie.

ANSWER 2. there are six relational and three logical operators in C:


six relational operators in C:
(1.) == (is equal to)
(2.) != (is not equal to)
(3.) > (is greater than)
(4.) < (is less than)
(5.) >= (is greater than or equal to)
(6.) <= (is less than or equal to)

three logical operators in C:


(1.) && (logical and)
(2.) ll (logical or)
(3.) ! (logical not)

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.

ANSWER 8. /* program to find GCD of two numbers */


#include<stdio.h>
#include<conio.h>

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;
}

Das könnte Ihnen auch gefallen