ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
how can i get this by using for loop?
*
**
*
****
*
******
 Question Submitted By :: Manojkumar
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how can i get this by using for loop? * ** * **** * ******
Answer
# 1
int i,j;
for(i=1;i<=3;i++)
{
print("*");
print("\n");
for(j=1;j<=i*2;j++)
print("*");
print("\n");
}
 
Is This Answer Correct ?    7 Yes 0 No
Suman_kotte
 
  Re: how can i get this by using for loop? * ** * **** * ******
Answer
# 2
#include<stdio.h>
#include<conio.h>
void main()
{
int m;
clrscr();
printf("enter the lines :");
scanf("%d",&m);
for(int i=1;i<=m;i+=2)
{
  for(int j=-2;j<=i;j+=2)
  printf("*");
  printf("*\n*");
}
getch();
}


thank u
 
Is This Answer Correct ?    0 Yes 0 No
Vignesh1988i
 
 
 
  Re: how can i get this by using for loop? * ** * **** * ******
Answer
# 3
sorry folks, a small mistake in above program , the below is the correct one's...........


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


thank u
 
Is This Answer Correct ?    0 Yes 0 No
Vignesh1988i
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
which of the following go out of the loopo if expn 2 becoming false a.while(expn 1){...if(expn 2)continue;} b.while(!expn 1){if(expn 2)continue;...} c.do{..if(expn 1)continue;..}while(expn 2); d.while(!expn 2){if(expn 1)continue;..} TCS2
Is it possible to create recycle bin in mobiles?  2
wap in c to accept n number display the highest and lowest value  2
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language  3
How the processor registers can be used in C ? HP4
two variables are added answer is stored on not for third variable how it is possible?  3
plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>  1
void main() {int a[5],i,b=16; for(i=0;i<5;i++) a[i]=2*i; f(a,5,b); for(i=0;i<5;i++) printf("\n %d",a[i]); printf("\n %d",b); } f(int *x,int n,int y) { int i; for(i=0;i<n;i++) *(x+i)+=2; y=y+2; }wat r the errors in the prg.and improvise the prg to get o/p.?  2
Which of these statements are false w.r.t File Functions? i)fputs() ii)fdopen() iii)fgetpos() iv)ferror() A)ii B)i,ii C)iii D)iv Accenture5
macros and function are related in what aspect? a)recursion b)varying no of arguments c)hypochecking d)type declaration HCL8
What is the diffrent between while and do while statement ?  5
what is c? Tech-Mahindra5
main is a predefined or user define function if user defined why? if predefined whay? TCS2
what is the code for getting the output as * ** *** Caritor5
1.find the second maximum in an array? 2.how do you create hash table in c? 3.what is hash collision Qualcomm6
what is diff between localstatic and globalstatis variable possible 2 use in another file...? HCL2
c program to add and delete an element from circular queue using array  1
write a program that finds the factorial of a number using recursion?  1
Why cann't whole array can be passed to function as value.  1
main() { char *p; p="Hello"; printf("%c\n",*&*p); } ME2
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com