1
o 1
1 0 1
0 1 0 1
1 0 1 0 1
how to design this function format in c-language ?

Answers were Sorted based on User's Feedback



1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,k,n;
clrscr();
printf("enter the terms :");
for(i=1;i<=n;i++)
{
if(i%2==0)
j=1;
else
j=0;
for(k=1;k<=i;k++)
{
j=!j;
printf("%d ",j);
}
printf("\n");
}
getch();
}



thank u

Is This Answer Correct ?    2 Yes 1 No

1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?..

Answer / premkumar

main()

{

int i,j,k=1; clrscr();

for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",k);
if(k==0)k=1;
else k=0;
}
printf("\n");
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

main() { char not; not=!2; printf("%d",not); }

1 Answers  


main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O

4 Answers   HCL,


main(){ unsigned int i; for(i=1;i>-2;i--) printf("c aptitude"); }

2 Answers  


How to reverse a String without using C functions ?

33 Answers   Matrix, TCS, Wipro,


Write a Program that Inputs 10 Numbers in an Array and Show the Maximum Number

2 Answers   Ace Info,






Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..

2 Answers  


what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


#include<stdio.h> main() { int a[2][2][2] = { {10,2,3,4}, {5,6,7,8} }; int *p,*q; p=&a[2][2][2]; *q=***a; printf("%d----%d",*p,*q); }

1 Answers  


char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)

1 Answers  


what is oop?

3 Answers  


How can i find first 5 natural Numbers without using any loop in c language????????

2 Answers   Microsoft,


Categories