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
#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 |
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 |
What are loops in c?
What is getch() function?
DIFFERNCE BETWEEN THE C++ AND C LANGUAGE?
Write a program that takes three variables(a,b,c) in as separate parameters and rotates the values stored so that value a goes to b,b,to c and c to a
Write a program to use switch statement.
0 Answers Agilent, Integreon, ZS Associates,
What is main void in c?
What are dynamically linked and statically linked libraries?
What is the difference b/w Structure & Class?
HOW CAN ADD OUR FUNCTION IN LIBRARY.
how do you programme Carrier Sense Multiple Access
what is pointer?
How to set file pointer to beginning c?