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

Answers were Sorted based on User's Feedback



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

Answer / vaishno

main()
{
int i=1;
printt:
printf("%d\n",i++);
if(i<=5)
goto printt;
getch();
}

Is This Answer Correct ?    16 Yes 5 No

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

Answer / i.c.jacobpaul

main()
{
int i=1;
printt:
printf("%d\n",i);
i++;
if(i<=5)
goto printt;
getch();
}

Is This Answer Correct ?    1 Yes 6 No

Post New Answer

More C Code Interview Questions

#include<stdio.h> main() { FILE *ptr; char i; ptr=fopen("zzz.c","r"); while((i=fgetch(ptr))!=EOF) printf("%c",i); }

1 Answers  


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.

5 Answers   Amazon, Microsoft,


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

1 Answers  


how many processes will gate created execution of -------- fork(); fork(); fork(); -------- Please Explain... Thanks in advance..!

8 Answers   GATE,


#define FALSE -1 #define TRUE 1 #define NULL 0 main() { if(NULL) puts("NULL"); else if(FALSE) puts("TRUE"); else puts("FALSE"); }

1 Answers  






#define int char main() { int i=65; printf("sizeof(i)=%d",sizeof(i)); }

1 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


Print an integer using only putchar. Try doing it without using extra storage.

2 Answers  


void main() { static int i; while(i<=10) (i>2)?i++:i--; printf(“%d”, i); }

2 Answers  


Find the largest number in a binary tree

7 Answers   Infosys,


what is oop?

3 Answers  


How will you print % character? a. printf(“\%”) b. printf(“\\%”) c. printf(“%%”) d. printf(“\%%”)

4 Answers   HCL,


Categories