how can i make a program with this kind of output..
Enter a number: 5
0
01
012
0123
01234
012345
01234
0123
012
01
0
Answers were Sorted based on User's Feedback
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int m;
printf("enter the limit value :");
scanf("%d",&m);
for(int i=0;i<(2*n+1);i++)
{
printf("\n");
if(i<n)
{
for(int j=0;j<=i;j++)
printf("%d",j);
}
else
{
for(int k=0;k<=j;k++)
printf("%d",k);
j--
}
}
getch();
}
| Is This Answer Correct ? | 11 Yes | 6 No |
Answer / vignesh1988i
A SMALL chnge in the above program... in first for loop 'n'
must be changed as 'm'
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / manoj
#include <stdio.h>
int main ()
{
/*declaration*/
int n = 5 ;
int i, j;
/*clean screen*/
clrscr();
/*actual functionality*/
for( i =0; i<=n; i++)
{
printf("\n");
for(j=0; j<=i; j++)
printf("%d",j);
}
for( i =4; i<n&&i>=0; i--)
{
printf("\n");
for(j=0; j<=i; j++)
printf("%d",j);
}
/*return to TC*/
getch();
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / salvin
A much more simpler implementation....
public class Test
{
public static void main(String[] args)
{
int no=5;
for(int n=0;n<=no;n++){
for(int m=0;m<=n;m++){
System.out.print(m);
}
System.out.println();
}
for(int n=no;n>=0;n--){
for(int m=0;m<n;m++){
System.out.print(m);
}
System.out.println();
}
}
}
| Is This Answer Correct ? | 2 Yes | 1 No |
There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.
When is a void pointer used?
why i join syntel?
23 Answers ABC, Syntel, TCS,
can u write a program in C, which does not use = (eqaul)or any arithmatic assignment(like -=,+=,*= etc) operator to swap to number?
how to estimate the disk access time? e.g. the time between read one byte and another byte in the disk.
Can two or more operators such as and be combined in a single line of program code?
difference between c and c++?
What is fflush() function?
what are advantages of U D F?
What are the types of bitwise operator?
Define recursion in c.
5) Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.without using big int and exponential function