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...


i want the code for printing the output as follows

4 4
3 3
2 2
1 1
0
1 1
2 2
3 3
4 4

Answers were Sorted based on User's Feedback



i want the code for printing the output as follows 4 4 3 3 2 2 1 1 ..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int m,i,j;
printf("enter the max. number for the series :");
scanf("%d",&m);
for(i=m;i<=0;i--)
{
for(j=0;j<m-i;j++)
printf(" ");
printf("%d",i);
for(j=1;j<=(2*m-(m-i+1+(m-i)));j++)
printf(" ");
printf("%d",i);
printf("\n");
}
i++;
j=m-1;
for(;i<=m;i++)
{
for(;j>(m-i);j--)
printf(" ");
printf("%d",i);
for(j=1;j<(2*i);j++)
printf(" ");
printf("%d",i);
printf("\n");
}
getch();
}

thank u

Is This Answer Correct ?    2 Yes 0 No

i want the code for printing the output as follows 4 4 3 3 2 2 1 1 ..

Answer / shafi dayatar

#include<stdio.h>

int main(){

int i=0,j=0;
for(i=0;i<9;i++){
for(j=0;j<9;j++){

if( i==j || i+j==8)
if(i<=4)
printf("%d",4-i);
else
printf("%d",i-4);
else
printf(" ");
}
printf("\n");
}

return 0;

}

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More C Interview Questions

what is the main use of c where it can use the c

2 Answers   Infosys,


i=20,k=0; for(j=1;j<i;j=1+4*(i/j)) { k+=j<10?4:3; } printf("%d", k);

8 Answers   HCL,


What are pragmas and what are they good for?

0 Answers  


Identify the operators that is not used with pointer a. && b. # c. * d. >>

2 Answers  


How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

0 Answers  


Explain union. What are its advantages?

0 Answers  


What is double pointer in c?

0 Answers  


In c programming, explain how do you insert quote characters (? And ?) Into the output screen?

0 Answers  


Explain how can a program be made to print the name of a source file where an error occurs?

0 Answers  


Which header file should you include if you are to develop a function which can accept variable number of arguments?

0 Answers   TCS, TISL,


how many types of operators are include in c language a) 4 b) 6 c) 8 d) 12

0 Answers  


What is true about the following C Functions a.Need not return any value b.Should always return an integer c.Should always return a float d.Should always return more than one value.

11 Answers   TCS,


Categories