Do you like reading books? If you do, then you must have encountered texts that have quite a wide space with dots in between them, just like pausing or thinking before proceeding the narration. Let's try doing that here in C, shall we?
Input
Two lines containing a string on each.
Cody
Handsome
Output
Multiple lines containing a string on each.
Cody
Handsome
SOLUTION TO THE ABOVE QUESTION
SOLUTION CODE IN JAVA
package com.company;
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//prompt the user to enter two strings
System.out.println("Input:\n");
System.out.print("Enter first string: ");
String first_string = sc.nextLine();
System.out.print("Enter second String: ");
String second_string = sc.nextLine();
System.out.println("\nOutput:\n");
//Let us print the first line
System.out.println(first_string);
//let us print three dots on different lines
for(int i = 0; i<3; i++)
{
System.out.println(".");
}
//Now let us print the last line
System.out.println(second_string);
}
}
SAMPLE PROGRAM OUTPUT
Comments
Leave a comment