//For this lab, you are to make a function that takes in an integer as an argume
ID: 3883847 • Letter: #
Question
//For this lab, you are to make a function that takes in an integer as an argument, and prints out that number, that number of times.
//For example if you were to call the function with the number 3, the output would be 333 - if you called it with 5, then it would be 55555.
Explanation / Answer
ans) the program is to be
#include<stdio.h>
#include<conio.h>
void printN(int x);
int main()
{
clrscr();
int num1;
puts("please enter number:");
scanf("%d",&num1);
printN(num1);
return 0;
}
void printN(int x)
{
for(int r=x;r>=x;r--)
{
puts("required output is to be:");
for(int c=1;c<=r;c++)
{
printf("%d",r);
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.