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 do you know about the use of bit field?
i=10,j=20 j=i,j?(i,j)?i:j:j print i,j
What is the use of printf() and scanf() functions?
helllo sir give me some information of the basic information the c as printf ,scanf , %d ,%f and why is the main use of these.
Diff: between this 2 classes in terms of memory class A { int i; char c; double d; }; class A { double d; int i; char c; }; How it is calculating?
What are different types of operators?
What is pointers in c with example?
What is the difference between NULL and NUL?
what are bps & baud rates? differentiate these two?
write a program to produce the following output; ABCDEFGFEDCBA ABCDEF FEDCBA ABCDE EDCBA ABCD DCBA ABC CBA AB BA A A
17 Answers ABC, College School Exams Tests,
while running a program, i got the msg that press return key to exit.what that mean in C as there are no such options as far i know.
What is the function of ceil(X) defined in math.h do? A)It returns the value rounded down to the next lower integer B)it returns the value rounded up to the next higher integer C)the Next Higher Value D)the next lower value