Algorithm Analysis
The task is to print the numbers from 1 to 5, each on a separate line.
Algorithm Implementation
Let's print the numbers as characters, separating them with the newline character \n.
#include <stdio.h>
int main(void)
{
printf("1\n2\n3\n4\n5\n");
return 0;
}Java Implementation
Let's print the numbers as characters, separating them with the newline character \n.
import java.util.*;
public class Main
{
public static void main(String[] args)
{
System.out.println("1\n2\n3\n4\n5\n");
}
}Python Implementation
Let's print the numbers as characters, separating them with the newline character \n.
print("1\n2\n3\n4\n5\n")