jituTechnology

jituTechnology

Write a program to print the numbers in the following format using loops

/*program to print numbers in the following format using loops.
Programmed by : kiran shrestha
Roll no. : 10121
Programmed on : 7th feb, 2011*/
#include <stdio.h>
#include <conio.h>
main ()
{
     int i,j;
   int a=1;
   for (i=1;i<=5;i++)
     {
           for (j=a;j<=a+2;j++)
                {
                     printf (“%d\t”,j);
                }
         for (j=a+1;j>=a;j–)
                {
                     printf (“%d\t”,j);
            }
           a=a+3;
           printf (“\n”);
      }
   getch();
}
output
1  2  3  2  1
4  5  6  5  4
7  8  9  8  7
10  11 12  11  10
13  14  15  14  13

No comments yet.

Add a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.



Connect with Me

GPO 8973 NPC 541; Kathmandu Nepal
Phone: +977 9851236800

Calendar

November 2025
S M T W T F S
 1
2345678
9101112131415
16171819202122
23242526272829
30