Respuesta :
Answer:
//To enter a string, and enter a pivot string, and then print in required sequence, the string from pivot string to last as first string, and printed before the left portion of string.
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner s1 = new Scanner(System.in);
System.out.println("Enter Main String:");
String f1 = s1.nextLine();
System.out.println("Enter pivot(string):");
String piv = s1.nextLine();
int start1 = f1.indexOf(piv);
int end1 = piv.length()+start1;
if (start1 == -1){
System.out.println("Error: Sub string(Pivot) cannot be found.");
return;
}
String first1 = f1.substring(0,start1-1);
String second1 = f1.substring(end1);
if (f1.charAt(start1-1)==' '){
System.out.println(second1 + " " + piv + " " + first1);
return;
}
System.out.println(second1 + piv + first1);
}
}
Explanation:
Please check the answer section
Answer:
n = int(input("How many numbers do you need to check? "))
odd = 0
even = 0
for i in range(1, n+1):
num = int(input("Enter number: "))
if (num % 2 == 0):
print(str(num)+ " is an even number.")
even = even + 1
else:
print(str(num)+ " is an odd number.")
odd = odd + 1
print("You entered " + str(even)+ " even number(s).")
print("You entered "+ str(odd)+ " odd number(s).")
Explanation:
Can I please have brainliest?