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
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 |
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 |
main() { int y; scanf("%d",&y); // input given is 2000 if( (y%4==0 && y%100 != 0) || y%100 == 0 ) printf("%d is a leap year"); else printf("%d is not a leap year"); }
Write a prog to accept a given string in any order and flash error if any of the character is different. For example : If abc is the input then abc, bca, cba, cab bac are acceptable, but aac or bcd are unacceptable.
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
write a program to Insert in a sorted list
how can u draw a rectangle in C
53 Answers Accenture, CO, Codeblocks, Cognizant, HCL, Oracle, Punjab National Bank, SAP Labs, TCS, University, Wipro,
How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!
main() { int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p } a. Runtime error. b. 1.00000 c. Compile error d. 0.00000
Give a very good method to count the number of ones in a 32 bit number. (caution: looping through testing each bit is not a solution)
write a program to find out roots of quadratic equation "x=-b+-(b^2-4ac0^-1/2/2a"
Is the following code legal? void main() { typedef struct a aType; aType someVariable; struct a { int x; aType *b; }; }
main() { char not; not=!2; printf("%d",not); }