1
232
34543
4567654
can anyone tell me how to slove this c question

Answers were Sorted based on User's Feedback



1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / sham

int main()
{
int i,j,k,l=0,n;
printf("Enter the length\n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
k=2;
for(j=0;j<i+l;j++)
{
if(i<=j)
{
printf("%d",i+j-k);
k=k+2;
}
else
printf("%d",i+j);
}
l++;
printf("\n");
}
}

Is This Answer Correct ?    13 Yes 5 No

1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / santhoo035

#include<stdio.h>
void di(int n)
{
int c=0,i,j;
for(i=1;i<n;i++)
{
for(j=i;j<=(2*i-1)+(i-1);j++)
{
if(j<(2*i-1))
{
printf("%d",j);
continue;
}
else if(j==(2*i-1))
c=j;
printf("%d",c--);
}
printf("\n");
}
}
int main()
{
di(5);
}

Is This Answer Correct ?    8 Yes 1 No

1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / anna

#include <stdio.h>

int main ()
{
int i;
for(i = 1; i <= 5; i++)
{
int k;
for(k = 0; k < 11 - i; k++)
{
printf(".");
}

int j;
for(j = 0; j < i; j++)
{
printf("%d", i + j);
}

for(j -= 2; j >= 0; j--)
{
printf("%d", i + j);
}

printf("\n");
}

return 0;
}

Is This Answer Correct ?    2 Yes 0 No

1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / anjali

#include <stdio.h>

int main ()
{
int k = 2;
int i, j,l;
for (i = 0; i < 5; i++)
{
for (j = i+1; j < k; j++)
{
printf("%d", j);
}
k = k + 2;
for (l = j - 2; l > i; l--)
{
printf("%d", l);
}
printf("\n");

}

Is This Answer Correct ?    4 Yes 3 No

1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / karthick

public class Num
{
public static void main(String[] args)
{
for(int i=1;i<=9;i++)
{
for(int l=9;l>=i;l--)
{
System.out.print(" ");
}
for(int j=i;j>=1;j--)
{

System.out.print(j);
if(j==1)
{
for(int k=2;k<=i;k++)
{
System.out.print(k);
}
}

}
System.out.println(" ");
}
System.out.println("-------------------");


for(int m=9;m>=1;m--)
{
for(int n=9;n>=m;n--)
{
System.out.print(" ");
}
for(int o=m;o>=1;o--)
{
System.out.print(o);
if(o==1)
{
for(int r=2;r<=m;r++)
{
System.out.print(r);
}
}

}System.out.println("");
}
}
}

Is This Answer Correct ?    1 Yes 1 No

1 232 34543 4567654 can anyone tell me how to slove this c question..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the lines :");
scanf("%d",&n);
for(int i=0;i<n;i++)
{
printf("\n");
for(int j=i+1;j<=(2*n+1);j++)
printf("%d",j);
for(int k=2*i;k>i;k--)
printf("%d",k);
}
getch();
}

Is This Answer Correct ?    1 Yes 5 No

Post New Answer

More C Interview Questions

What is the difference b/w Structure & Union?

3 Answers  


In which layer of the network datastructure format change is done

0 Answers   Honeywell,


Can we replace the struct function in tree syntax with a union?

0 Answers   Huawei,


what will be the output for the following main() { printf("hi" "hello"); }

5 Answers   RoboSoft,


Why cann't whole array can be passed to function as value.

1 Answers  






What are the advantages of external class?

0 Answers  


Write a program for Overriding.

0 Answers  


Write a program to compute the following 1!+2!+...n!

4 Answers  


cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration

0 Answers  


Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?

3 Answers   HCL, TCS,


Write a program for finding factorial of a number.

0 Answers   Tech Mahindra,


why 'c' is called middle level language.

2 Answers  


Categories