Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how can i get output the following...
5 4 3 2 1
4 3 2 1
3 2 1
2 1
1

and

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

plz plz...

Answers were Sorted based on User's Feedback



how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and ..

Answer / aditi

For first one:-
void main ()
{
for (int i= 5; i>= 1; i--)
{
for (int k=5; k >= 1; k--)
{
if (k> i)
printf(" ");
else
printf ("%d", k);
}
printf("\n");
}
}


For second:-
void main ()
{
int n = 0;

for (int i=1; i<6; i++)
{


for (int k=1; k <= i; k++)
{
n = n +1;
printf ("%d ", n);
}
printf("\n");
}
}

Is This Answer Correct ?    12 Yes 1 No

how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and ..

Answer / abhishek karnani

void main ()
{
int i,k,j;
clrscr();
for (i=0;i<5;i++)
{

for (j=5;j>=i+1;j--)
{
printf ("%d",j);
}
printf("\n");
for (k=0;k<j+1;k++)
{
printf(" ");
}


}

}

Is This Answer Correct ?    2 Yes 1 No

how can i get output the following... 5 4 3 2 1 4 3 2 1 3 2 1 2 1 1 and ..

Answer / anas

for(i=n;i>=1;i--)
{
for(c=1;c<=n-i;c++)
{
cout<<" ";
}
for(k=i;k>=1;k--)
{
cout<<k;
}
cout<<"\n";
}
----------------------------------------------
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
//for second.
int n=1;
for(int i=1;i<=5;i++)
{
for(int j=1;j<=i;j++)
{
cout<<n<<" ";
n++;
}
cout<<"\n";
}
getch();
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

what is the output of below code int x=8,y; x>>=2; y=x; what is y value. NOTE:EXPLANATION IS COMPALSARY with binary bits

2 Answers   Wipro,


Which is best linux os?

0 Answers  


What are the types of unary operators?

0 Answers  


how is the examination pattern?

0 Answers   Wipro,


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

0 Answers  


What is use of #include in c?

0 Answers  


What does #pragma once mean?

0 Answers   Celstream,


What is context in c?

0 Answers  


c program to compute AREA under integral

0 Answers   Infosys,


What is difference between array and pointer in c?

0 Answers  


Why is c called c not d or e?

0 Answers  


program in c to print 1 to 100 without using loop

9 Answers   Wipro,


Categories