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

source code for delete data in array for c

1 Answers   TCS,


main() { extern int i; i=20; printf("%d",sizeof(i)); }

2 Answers  


can you use proc sql to manpulate a data set or would u prefer to use proc report ? if so why ? make up an example and explain in detail

0 Answers   TCS,


can u give me the c codings for converting a string into the hexa decimal form......

1 Answers  


main() { int i, n; char *x = “girl”; n = strlen(x); *x = x[n]; for(i=0; i<n; ++i) { printf(“%s\n”,x); x++; } }

2 Answers  






3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

0 Answers   RoboSoft,


# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }

1 Answers  


How to return multiple values from a function?

7 Answers  


Printf can be implemented by using __________ list.

3 Answers  


void main () { int x = 10; printf ("x = %d, y = %d", x,--x++); } a. 10, 10 b. 10, 9 c. 10, 11 d. none of the above

2 Answers   HCL,


main() { int i = 100; clrscr(); printf("%d", sizeof(sizeof(i))); } a. 2 b. 100 c. 4 d. none of the above

5 Answers   HCL,


which function is used to clear the buffer stream on gcc? for example: I wrote following code on gcc #include<stdio.h> int main(void) { char ch; int a,b; printf("\nenter two numbers:\t"); scanf("%d%d",&a,&b); printf("enter number is %d and %d",a,b); printf("\nentercharacter:\t"); scanf("%c",&ch); printf("enter character is %c",ch); return 0; } in above progarm ch could not be scan. why?plz tell me solution.

2 Answers  


Categories