Please enter your email:

1. Pattern:

$#$#
$#$#
$#$#
$#$#

Code:

for(i = 1; i <= 4; i++) {
for(j = 1; j <= 4; j++) {
if( ? )
printf(“$”);
else
printf(“#”);
}
printf(“\n”);
}

 
 
 
 

2. Floyd’s Triangle:

1
2 3
4 5 6
7 8 9 10

Code :

num = 1;
for(i = 1; ? ; i++) { // Outer Loop
for(j = 1; ? ; j++) { // Inner Loop
printf(“%d “, num++);
}
printf(“\n”);
}

 
 
 
 

3. Number Traingle:

1
1 2
1 2 3
1 2 3 4

Code:

for(i = 1; ? ; i++) { // Outer Loop
for(j = 1; ? ; j++) // Inner Loop
printf(“%d “, j);
printf(“\n”);
}

 
 
 
 

4. Pattern:

* * * *
* * * *
* * * *
* * * *

Code:

for(i = 1; ? ; i++) { // Outer Loop
for(j = 1; ? ; j++) // Inner Loop
printf(“* “);
printf(“\n”);
}

 
 
 
 

5. Pattern:

$####
#$###
##$##
###$#
####$

Code:

for(i = 1; i <= 5; i++) {
for(j = 1; j <= 5; j++) {
if( ? )
printf(“$”);
else
printf(“#”);
}
printf(“\n”);
}

 
 
 
 

6. Numbers Pattern:

1 2 3 4
1 2 3
1 2
1

Code :

for(i = 4; ? ; i–) { // Outer Loop
for(j = 1; ? ; j++) // Inner Loop
printf(“%d “, j);
printf(“\n”);
}

 
 
 
 

7. Pattern:

*
* *
* * *
* * * *

Code:

for(i = 1; ? ; i++) { // Outer Loop
for(j = 1; ? ; j++) // Inner Loop
printf(“* “);
printf(“\n”);
}

 

 
 
 
 

8. Pattern:

* * * *
* * *
* *
*

Code:

for(i = 4; ? ; i–) { // Outer Loop
for(j = 1; ? ; j++) // Inner Loop
printf(“* “);
printf(“\n”);
}

 
 
 
 

9. Pattern:

$$$$$
$###$
$###$
$###$
$$$$$

Code:

for(i = 1; i <= 5; i++) {
for(j = 1; j <= 5; j++) {
if( ? )
printf(“$”);
else
printf(“#”);
}
printf(“\n”);
}

 
 
 
 

10. Pattern:

$$$$#
$$$$#
$$$$#
$$$$#
$$$$#

Code:

for(i = 1; i <= 5; i++) {
for(j = 1; j <= 5; j++) {
if( ? )
printf(“#”);
else
printf(“$”);
}
printf(“\n”);
}

 
 
 
 

Question 1 of 10

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat Icon