WAP to display 1,2,3,4,5........N
Answers were Sorted based on User's Feedback
Answer / sreejesh1987
#include<stdio.h>
#include<conio.h>
void main()
{
int i,n;
clrscr();
printf("\nEnter n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
printf("%d ",i);
getch();
}
| Is This Answer Correct ? | 11 Yes | 3 No |
Answer / arti sharma
void main()
{ int i,n,k;
printf("enter the limit");
scanf("%d",&n);
k=1;
i:
if(k<=n)
{ printf("%d",k);
k++;
goto i;
}
getch();
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Is the following statement a declaration/definition. Find what does it mean? int (*x)[10];
Program to find the largest sum of contiguous integers in the array. O(n)
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; }
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)
‎#define good bad main() { int good=1; int bad=0; printf ("good is:%d",good); }
void main() { char ch; for(ch=0;ch<=127;ch++) printf(“%c %d \n“, ch, ch); }
Finding a number which was log of base 2
main() { int i=10,j=20; j = i, j?(i,j)?i:j:j; printf("%d %d",i,j); }
char *someFun() { char *temp = “string constant"; return temp; } int main() { puts(someFun()); }
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
What is the output for the following program main() { int arr2D[3][3]; printf("%d\n", ((arr2D==* arr2D)&&(* arr2D == arr2D[0])) ); }
main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }