Computer Science, asked by jiyaanastasya, 4 months ago

Program pascal
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15​

Answers

Answered by darshan32186
0

Answer:

C program to print the given number pattern using for loop

Input

Input N: 5

C program to print the given number pattern

#include <stdio.h>

int main()

{

  int i, j, diff, value, N;

  printf("Enter rows: ");

  scanf("%d", &N);

  for(i=1; i<=N; i++)

  {

      diff = N-1; // Initialize difference to total rows - 1

      value = i;  // Initialize value to the current row number

      for(j=1; j<=i; j++)

      {

          printf("%-3d", value);

          value += diff; // Computes the next value to be printed

          diff--;        // Decrements the difference

      }

      printf("\n");

  }

  return 0;

Explanation:

Similar questions