小编Ben*_*nLa的帖子

Recursion in c to print characters

I need to write a function that receive two arguments, n and 2 characters, from void main and then to print the first character n times and the second character n*2. I can only use recursion, not strings or anything more advanced. I tried different variations but after the recursion the prog isn't going down to the statement of printf to print ch2 twice. can someone help?

Thanks in advance.

#include<stdio.h>
void string_rec(int num, char ch1, char ch2)
{
    if …
Run Code Online (Sandbox Code Playgroud)

c recursion

0
推荐指数
1
解决办法
88
查看次数

标签 统计

c ×1

recursion ×1