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 |
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure
Tell us something about keyword 'auto'.
Print all the palindrome numbers.If a number is not palindrome make it one by attaching the reverse to it. eg:123 output:123321 (or) 12321
to find out the reverse digit of a given number
6 Answers Infosys, Microsoft, TCS, Wipro,
difference between object file and executable file
#include<stdio.h> int main( ) { Int a=300, b, c; if(a>=400) b=300; c=200; printf(“%d%d ”, b, c); return0; }
What is void main ()?
How can we see the Expanded source code and compiled code for our source program in C?
while initialization of array why we use a[][2] why not a[2][]...?
what is the coding of display the factorial of a number using array and function?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
program for following output using for loop? 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5