1
232
34543
4567654
can anyone tell me how to slove this c question
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
What is maximum size of array in c?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
void main() { int i=5; printf("%d",i++ + ++i); }
Write the syntax and purpose of a switch statement in C.
Why doesn't C have nested functions?
Explain what is wrong with this program statement?
A array contains dissimilar element how can we count, and A array contains dissimilar element how can we store in another array with out repetition.
What does sizeof function do?
Write a C program to fill a rectangle using window scrolling
What is the purpose of clrscr () printf () and getch ()?
What will be the output of the following program #include<stdio.h> void main() { int i=20; i-=i+++++i++; printf("%d",i); }
Explain how do you determine the length of a string value that was stored in a variable?