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 |
find the minimum of three values inputted by the user
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
What is an example of structure?
What Is The Difference Between Null And Void Pointer?
What are pointers in C?
how 2 compile & execute c program with out using editor?
#include<stdio.h> int main(){ int i=10; int *ptr=&i; *ptr=(int *)20; printf("%d",i); return 0; } Output: 20 can anyone explain how came the output is 20
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
what is constant pointer?
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language
Why do we need functions in c?
1. What will be the output of the following programs. a) #include <stdio.h> Main() { Int x=4; While(x==1) { X=x-1; Printf(ā%dā,x); --x; } }