Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a program to give following output.....
*********
**** ****
*** ***
** **
* *
** **
*** ***
**** ****
*********

Answers were Sorted based on User's Feedback



Write a program to give following output..... ********* **** **** *** *** ** ** * *..

Answer / monty

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
for(a=1;a<10;a++)
{
for(b=1;b<10;b++)
{
if((a==2 && b==5) ||
(a==3 && (b==4 || b==5 || b==6) )
||
(a==4 && (b>=3 && b<=7) )
||
(a==5 && (b>=2 && b<=8) )
||
(a==6 && (b>=3 && b<=7) )
||
(a==7 && (b==4 || b==5 || b==6) )
||
(a==8 && b==5))
printf("-");
else
printf("*");
}
printf("\n");
}
getch();
}

Is This Answer Correct ?    5 Yes 1 No

Write a program to give following output..... ********* **** **** *** *** ** ** * *..

Answer / vignesh1988i

sorry i have done a small mistake ..... this is correct

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

Is This Answer Correct ?    4 Yes 2 No

Write a program to give following output..... ********* **** **** *** *** ** ** * *..

Answer / vignesh1988i

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


i think this may work

thank u

Is This Answer Correct ?    4 Yes 4 No

Write a program to give following output..... ********* **** **** *** *** ** ** * *..

Answer / prakash

int main()
{
int i, j, star, space, n, middle;

printf("Enter the max. number of stars in a line:");
scanf("%d", &n);
printf("Output:\n");

star = n/2;
space = 1;
middle = n/2 + 1;

for (j = 1; j <= n; j++)
printf("*");
printf("\n");

for (i = 2; i <= (n - 1); i++)
{
for (j = 1; j <= n; j++)
{
if ((j >= (star + 1)) &&
(j <= (star + space)))
{
printf(" ");
}
else
{
printf("*");
}
}

// calculate a and b
if (i < middle)
{
star -= 1;
space += 2;
}
else
{
star += 1;
space -= 2;
}

printf("\n");
}

for (j = 1; j <=n; j++)
printf("*");
printf("\n");

return 0;
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

print pattern 1 1 33 33 555 555 77777777 555 555 33 33 1 1

1 Answers   Winit,


WHO WROTE C LANGUAGE?

4 Answers  


Look at the Code: #include<string.h> void main() { char s1[]="abcd"; char s2[10]; char s3[]="efgh"; int i; clrscr(); i=strcmp(strcat(s3,ctrcpy(s2,s1))strcat(s3,"abcd")); printf("%d",i); } What will be the output? A)No output B) A Non Integer C)0 D) Garbage

7 Answers   Accenture,


find the sum of two matrices and WAP for it.

0 Answers   Huawei,


Explain About fork()?

0 Answers   TISL,


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include<stdio.h>...

0 Answers  


What is c language in simple words?

0 Answers  


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

0 Answers   GrapeCity,


what is the need for main function in c?

5 Answers  


What is equivalent to ++i+++j?

0 Answers  


What are volatile variables in c?

0 Answers  


What is the purpose of the fflush() function in C?

2 Answers  


Categories