Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given an int variable n that has already been declared and initialized to a posi

ID: 3798533 • Letter: G

Question

Given an int variable n that has already been declared and initialized to a positive value and another int variable j that has already been declared , use for loop to print a single line consisting of n asterisk. Thus if n contains 5 , five asterisks will be printed. Use no variables other than n and j. ( please use C standard) Given an int variable n that has already been declared and initialized to a positive value and another int variable j that has already been declared , use for loop to print a single line consisting of n asterisk. Thus if n contains 5 , five asterisks will be printed. Use no variables other than n and j. ( please use C standard)

Explanation / Answer

#include <stdio.h>

int main()
{
int n = 5;
int j;
for(j=1; j<=5; j++){
printf("* ");
}

printf(" ");

return 0;
}

Output:

sh-4.2$ gcc -o main *.c                                                                                                                                                                                                                                                

sh-4.2$ main                                                                                                                                                                                                                                                           

* * * * *

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote