Complete Question:
Write a while (or for) statement to print all the digits of an int type variable x, one digit per line For example, if int x 38625, then the output should be in 5 lines as 60 (Hint: You may use built-in method to get a String representation of x then print out each character in String)
***** Java *****
Answer:
import java.util.*;
public class Main{
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int x = input.nextInt();
String str = Integer.toString(x);
for(int i =0;i<str.length();i++) {
System.out.println(str.charAt(i));
}
}
}
Explanation:
This line prompts user for input
System.out.print("Enter an integer: ");
This line gets user input
int x = input.nextInt();
This line converts user input to string
String str = Integer.toString(x);
The following loop iterates through the converted string
for(int i =0;i<str.length();i++) {
This prints each character on the string
System.out.println(str.charAt(i));
}
which of these are correctly formatted python lists? check all that apply
Options
-list1=(race, cars, trucks, bikes)
-list2=["computer science', 'math', 'psychology']
-list3=('summer', 'winter', 'spring')
-list5[52, 24, 71, 56]
The first and third option are actually tuples, not lists. Tuples and lists are identical except for the fact that you cannot change the elements in a tuple but you can in a list. The last option is incorrect because there is no equal sign that assigns those numbers to the variable name list5.
The only option that makes sense is option 2, list2
Answer:
B, C, and E :)
Explanation:
are you absent minded because you are thinking of an online activity?
Answer:
No . It doesn't mean that person thinking an online activity is absent minded bcoz while we are thinking any activities our mind is working and while doing anything there is presence of our mind so i don't think thinking an online activity is absentminded .
In my idea.
Font size means the height of characters.
True
False
Answer:
Hey dude....
Explanation:
This is ur answer....
TrueHope it helps!
Brainliest pls!
Follow me! :)