Given an int variable k that has already been declared, write some code that uses a for loop to print a single line consisting of 97 asterisks. Use no variables other than k.

Answer :

Answer:

The program to the given statement can be defined as follows:

Program:

//header file

#include <stdio.h> //defining header file

int main() //defining main method

{

int k; //defining integer variable k

for (k=1;k<=97;k++) //defining for loop

{

printf("*"); //print value asterisks

}

return 0;

}

Output:

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

Explanation:

Firstly, the headers file is included in the above C-language, and then the main method is described and all computations are performed with this method, which can be described as follows:

  • Inside the main method, an integer variable k is declared.
  • In the next line, the for loop is declared, which uses the variable k, which starts from 1 and ends when the value of k is less than equal to 97, inside the loop, it will print asterisks.

Other Questions