You are on page 1of 2

Answer key (FUNDAMENTALS OF C PROGRAMMING)

PART A

1. printf() / putch() / puts() / putchar()


2. integer / real /string / single character /back slash character
3. if / if… else/switch / go to / conditional operator.
PART B
1. primary, derived, userdefined data types
2. # include<stdio.h>
void main ()
{
int x, y, z;
printf(“enter the value of x”) ;
scanf(“%d”, &x) ;
printf(“enter the value of y”) ;
scanf(“%d”, &y) ;
z = x+y;
printf(“value of sum is %d”, z) ;
}
3. In the above program replace + by * and sum by product

PART C

1. #include<stdio.h>
void main ()

int x, y;

printf(“enter the value of x”) ;

scanf(“%d”, &x) ;

printf(“enter the value of y”) ;

scanf(“%d”, &y) ;

if(x>y)

printf(“ x is greater “) ;

else

printf(“y is greater “) ;
}

2. include<stdio.h>
void main ()
{
int x;
printf(“enter the value of x”) ;
scanf(“%d”, &x) ;
if(x%5==0)
{
x =x+10;
}
else
{
x=x-10;
}
printf(“value of x = %d”, x) ;
}

You might also like