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

Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

13 Answers   Intel, Microsoft, TCS,


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


how to return a multiple value from a function?

5 Answers   Wipro,


Is there any difference between the two declarations, 1. int foo(int *arr[]) and 2. int foo(int *arr[2])

1 Answers  


Find the largest number in a binary tree

7 Answers   Infosys,






main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); } int i;

1 Answers  


main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }

6 Answers  


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)

7 Answers   Microsoft,


find A^B using Recursive function

2 Answers  


main() { int i=3; switch(i) { default:printf("zero"); case 1: printf("one"); break; case 2:printf("two"); break; case 3: printf("three"); break; } }

1 Answers  


#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }

4 Answers   Google, HCL, Quick Heal, WTF,


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


Categories