Week 1 Questions
Week 1 Questions
}
}
3 Find the output: A. 1,10
#include<stdio.h>int B. 9,11
main() C. 9,19
{ D. 1,19
int x=10;
int a=1,b=2,c=3,d=4;
x+=a=b*c+d-a;
printf("%d,%d",a,x);
}
b=(5,4);
printf("%d",a+b);
}
11 Which of the following condition A. a==10
checks will print 10 twice? B. a <= 10
C. printf("\n
void main(){ %d",a)
int a=10; D. None of theabove
if( )
printf("\n%d",a);
else
printf("\n%d %d",a,a);
}
12 #include<stdio.h> i. 9
ii. 11
main ( ) iii. 13
{ iv. 15
int a=5;
int b = a % ( a−a /2 ) ∗ ( a
—3)+a;
printf(”%d”,b);
return 0 ;
}
14 #include<stdio.h> a. 1
b. 2
int main(){ c. 4
int i=1; d. 7
i += i*i>>2+3;
printf("%d",i);
return 0;
}
Give the result of compiling and
running the above program?
15 #include<stdio.h> a. 15
b. 24
int main(){ c. 33
int i=1; d. 34
i += i*i<<2+3;
printf("%d",i);
return 0;
}
Give the result of compiling and
running the above program?
Programming Question #1
Write a program to find the number of perfect squares between given two numbers A and B
(both inclusive). A number is called a perfect square if it can be written as x*x for some integer x.
Programming Question #2
Write a program to find whether a given number (say x) is a “perfect number” or not.
Programming Qn #3
Write a C program that takes a positive number N and produces an output that is the product of
its digits.