Professional Documents
Culture Documents
Task - 1: The Value Is %D/N" %D %D" 5
Task - 1: The Value Is %D/N" %D %D" 5
Task - 1: The Value Is %D/N" %D %D" 5
6-
How many times the while loop will get executed?
#include<stdio.h>
int main()
{
int j=1;
while(j <= 255)
{
printf("%c %d\n", j, j);
j++;
}
return 0;
}
A. Infinite times
B. 255 times
C. 256 times
D. 254 times
7-
Point out the error, if any in the for loop.
#include<stdio.h>
int main()
{
int i=1;
for(;;)
{
printf("%d\n", i++);
if(i>10)
break;
}
return 0;
}
D. No error
8- By default, the data type of a constant without a decimal point is int, whereas the one with a
decimal point is a double.
A. Yes
B. No
Write the code of the following programs:
1- Write a program in C to display the first 10 natural numbers.
Expected Output:
1 2 3 4 5 6 7 8 9 10
4- Write a program in C to display the pattern like right angle triangle with a
number.
The pattern like:
1
12
123
1234
5- Write a program in C to make such a pattern like right angle triangle with a
number which will repeat a number in a row.
The pattern like:
1
22
333
4444