Use a for loop. Print all integers from to in descending order with the text "" in a column.
Algorithm implementation
Read the input data.
scanf("%d", &n);Print the numbers from to in descending order with the text "" in a column.
for (i = n; i >= 0; i--)
printf("%d sek\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 = n; i >= 0; i--)
System.out.println(i + " sek");
con.close();
}
}Python implementation
Read the input data.
n = int(input())Print the numbers from to in descending order with the text "" in a column.
for i in range(n, -1, -1):
print(i, "sek")