Write a C program to print the numbers from 1 to 10 without using any looping statements (for/while/do while)
also do not write printf() 10 times
also do not write printf() 10 times
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
static unsigned int counter=1; | |
if(counter<=10) | |
{ | |
printf("%d\t",counter); | |
counter++; | |
main(); | |
} | |
return 0; | |
} |
No comments:
Post a Comment