Use a for loop. Print the line numbers and the text "OK".
Algorithm Implementation
Read the input value of .
scanf("%d", &n);Print the numbered text "OK" times.
for (i = 1; i <= n; i++)
printf("%d OK\n", i);Java Implementation
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner con = new Scanner(System.in);
int n = con.nextInt();
for (int i = 1; i <= n; i++)
System.out.println(i + " OK");
con.close();
}
}Python Implementation
Read the input value of .
n = int(input())Print the numbered text "OK" times.
for i in range(1,n+1):
print(i,"OK")