Â
This is a for loop program in which we will print a very simple pattern of numbers in reverse, with the help of the C Programming language.
#include <stdio.h>
void main()
{
int rows;
printf( "\nEnter the number of rows\n");
scanf("%d",&rows);
printf("\n");
for (int i = 1; i <= rows; i++)
{
for (int j = rows; j >= 1; j--)
{
printf("%d ", j);
}
printf("\n");
}
}
#ENJOY CODING
Hi i want to ask looping code for output below
ReplyDelete3 5 7 9
6 8 10 12
9 11 13 15
12 14 16 18
15 17 19 21
#include
Deleteint main()
{
int i, j, k, x;
x = 3;
for (i = 3; i <= 15; i++)
{
if (i % 2 == 0)
k = i + 2;
else
k = i;
for (j = 1; j <= 4; j++)
{
printf(" %d", k);
k += 2;
x = k;
}
printf("\n");
}
return 0;
}
The above given code nearly satisfies your required Query.
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP