How can i make this lunix code print 3 numbers in reverse it

How can i make this lunix code print 3 numbers in reverse

it must be in printStars format and no loops

Here is the code i have but can figure out how to reverse the numbers

#include<stdio.h>

void printStars(int n)
{
if (n>0){
printf(\"\");
printStars(n-1);
}
}
int main()
{
int n;
int b;
int c;
printf(\"Enter 3 numbers to reverse \");
scanf(\"%d\",&n,&b,&c);
printf(\"your reversed numbers are %d\",n);
printStars(n);
return 0;

Solution

#include<stdio.h>
#include<stdlib.h>
void printStars(int s)
{
if (s>0){
printf(\"*\");
printStars(s-1);
}
}
char* reverse(char *str)
{
static int i=0;
static char rev[100];
if(*str)
{
reverse(str+1);
rev[i++] = *str;
}
return rev;
}

int main()
{
  
char no[100];
char *revno;
printf(\"Enter a no\\t\");
scanf(\"%s\", no);
int n=atoi(no);
printf(\"The original no is %s \ \", no);
revno = reverse(no);
printf(\"The reversed no is %s \ \", revno);

printf(\"\ \");
printStars(n);

getch();
return 0;
}

output

Enter a no 25
The original no is 25
The reversed no is 52

*************************

How can i make this lunix code print 3 numbers in reverse it must be in printStars format and no loops Here is the code i have but can figure out how to reverse
How can i make this lunix code print 3 numbers in reverse it must be in printStars format and no loops Here is the code i have but can figure out how to reverse

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site