You are here:

C/urgently required solution(m havin my exam 2morrow)

Advertisement


Question
1)w.a.p
           1
          12
         123
        1234

2)w.a.p
     1      1
     12    12
     123  123
     12341234

3)w.a.p
      12341234
      123  123
      12    12
      1      1


Answer
Hi dear shika !

Here im presenting 2 programs sure that will help you out to program all the possible outputs given above with a minor modifications



#include<stdio.h>
void main()
{
  int i , j;
  clrscr();
  for( i = 1 ; i <= 4 ; i ++)
  {
     for( j = 1 ; j <= i ; j++)
        printf("%d ", j);

     printf("\n");
  }
  getch();
}

void main()
{
  int i , j;
  clrscr();
  for( i = 4 ; i >= 1 ; i--)
  {
     for( j = i ; j >= 1 ; j--)
        printf("%d ", j);

     printf("\n");
  }
  getch();
}

All the best.
Thanks and regards !
Prince M. Premnath

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Prince M. Premnath

Expertise


I'm sure that I can solve any doubts in Turbo C ,Graphics Programing ,Mouse, Hardware Programming ,File System ,Interrupts, BIOS handling , TSR Programming , General Concepts in C Language, handling inline Assembly statements

Experience

Research over 6+ Years

Organizations
CG-VAK Softwares and Exports Limited

Education/Credentials
Masters in Computer Applications

©2012 About.com, a part of The New York Times Company. All rights reserved.