002. Technical interview question: Print your name 5 times without a loop

#include <stdio.h>
void printstring(char* name, int count)
{
    printf("%d : %s\n",count+1,name);
    count+=1;
    if(count<=5)
        printstring(name, count);
}
int main()
{
    char name[50]; 
    printf("\n Enter you name :");
    scanf("%s", name);
    printstring(name,1);
    return 0;
}
Watch all videos like this

Leave a Reply

Your email address will not be published. Required fields are marked *