parkside's triangle..

create a program like this..

enter the size: 6
enter the seed: 1

output:

1
23
456
7891
23456
789123

sample2:

enter the size: 5
enter the seed: 3

output:

3
45
678
9123
45678

parkside should not exceed 10 while its seed should only be
not more than 9..

Answers were Sorted based on User's Feedback



parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 ..

Answer / vignesh1988i

super problem this is......

#include<stdio.h>
#include<conio.h>
void main()
{
int count ,m,n;
printf("enter the size :");
scanf("%d",&m);
printf("enter the seed :");
scanf("%d",&n);
count =n;
for(int i=1;i<=m;i++)
{
printf("\n");
for(j=1;j<=i;j++)
{
printf("%d",count);
count++;
if(count>=10)
count=1;
}
}
getch();
}

thank you

Is This Answer Correct ?    10 Yes 3 No

parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 ..

Answer / vignesh1988i

a smalll change in this program...... sorry for the inconvience

#include<stdio.h>
#include<conio.h>
void main()
{
int m,n;
printf("enter the size :");
scanf("%d",&m);
printf("enter the seed :");
scanf("%d",&n);
if(n>=10)
n=1;
for(int i=1;i<=m;i++)
{
printf("\n");
for(j=1;j<=i;j++)
{
printf("%d",n);
n++;
if(n>=10)
n=1;
}
}
getch();
}

Is This Answer Correct ?    4 Yes 5 No

parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 ..

Answer / prashant

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
printf("enter the size");
scanf("%d",&n1);
printf("enter the seed");
scanf("%d",&n2);
for(i=1;i<n1;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
getch();
}

Is This Answer Correct ?    2 Yes 9 No

parkside's triangle.. create a program like this.. enter the size: 6 enter the seed: 1 ..

Answer / dally

/////********For first question**********/
#include<stdio.h>
int main()
{
int n,i,j,k=1;

printf("Enter values for n\n") ;
scanf("%d",&n);
for(i=0;i<=n;i++)
{
for(j=0;j<=i;j++)
printf("%d\n",k);
printf("\n");
k++;
}
}
IT WILL PRINT
1
2 3
4 5 6
7 8 9 10

********************************
For second question
********************************

#include<stdio.h>
int main()
{
int i,j,n,k=3;

printf("Enter value for n\n") ;
scanf("%d",&n);

for(i=0;i<=n;i++)
{
for(j=0;j<=i;j++){
printf("%d",k);
k++;
}
printf("\n");
if(k == 10)
k=1;
}

}
IT WILL PRINT
3
45
678
9123
45678

Is This Answer Correct ?    1 Yes 11 No

Post New Answer

More C Interview Questions

write a program to print calender using for loop.

1 Answers   HCL, TCS,


What are the different file extensions involved when programming in C?

0 Answers  


Write a program to print distinct words in an input along with their count in input in decreasing order of their count..

1 Answers  


What does %p mean c?

0 Answers  


main() { char *p1="Name"; char *p2; p2=(char *)malloc(20); while(*p2++=*p1++); printf("%s\n",p2); }

4 Answers   CitiGroup,






how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?

0 Answers  


How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST

6 Answers   Adobe, Huawei,


Is it fine to write void main () or main () in c?

0 Answers  


Find the highest of three numbers and print them using ascending orders?

1 Answers  


Describe how arrays can be passed to a user defined function

0 Answers  


What are structure members?

0 Answers  


When c language was developed?

0 Answers  


Categories