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

What is getch c?

0 Answers  


Can you add pointers together? Why would you?

0 Answers  


 Illustrate it   summing the series 2+4+6+......to n terms using  (i) while loop (ii) do-while loop

2 Answers  


What is substring in c?

0 Answers  


What is a pointer?

1 Answers   ADP, IFFCO,






What are the types of i/o functions?

0 Answers  


What is the use of c language in real life?

0 Answers  


why division operator not work in case of float constant?

2 Answers  


What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation

10 Answers   IBM,


Why c is a mother language?

0 Answers  


What language is windows 1.0 written?

0 Answers  


how to exchnage bits in a byte b7<-->b0 b6<-->b1 b5<-->b2 b4<-->b3 please mail me the code if any one know to rajeshmb4u@gmail.com

3 Answers   Honeywell, Huawei,


Categories