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 |
Explain what is the benefit of using enum to declare a constant?
What are the types of operators in c?
Would you rather wait for the results of a quicksort, a linear search, or a bubble sort on a 200000 element array? 1) Quicksort 2) Linear Search 3) Bubble Sort
How to write in a function declaration and in function call in which the function has 'n' number of varible or arguments?
Are negative numbers true in c?
Why is event driven programming or procedural programming, better within specific scenario?
Explain what does a function declared as pascal do differently?
Take an MxN matrice from user and then sum upper diagonal in a variable and lower diagonal in a separate variables. Print the result
Given an array of numbers, except for one number all the others occur twice. Give an algorithm to find that number which occurs only once in the array.
write a program to create a sparse matrix using dynamic memory allocation.
i have to apply for the rbi for the post of officers. i need to know abt the entrance questions whether it may be aps or techinical....
How do I round numbers?