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 |
why is printf("%d %d %d",i++,--i,i--);
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }
Printf can be implemented by using __________ list.
write a program to Insert in a sorted list
int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }
void ( * abc( int, void ( *def) () ) ) ();
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }
Program to find the largest sum of contiguous integers in the array. O(n)
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
Which one is taking more time and why ? :/home/amaresh/Testing# cat time.c //#include <stdio.h> #define EOF -1 int main() { register int c; while ((c = getchar()) != EOF) { putchar(c); } return 0; } ------------------- WIth stdio.h:- :/home/amaresh/Testing# time ./time_header hi hi hru? hru? real 0 m4.202s user 0 m0.000s sys 0 m0.004s ------------------ Witout stdio.h and with #define EOF -1 =================== /home/amaresh/Testing# time ./time_EOF hi hi hru? hru? real 0 m4.805s user 0 m0.004s sys 0 m0.004s -- From above two case , why 2nd case is taking more time ?
how can i cast a char type array to an int type array
Which version do you prefer of the following two, 1) printf(ā%sā,str); // or the more curt one 2) printf(str);