24 תשובות
איזה שפה?
שואל השאלה:
גאבה
גאבה
אנונימית
^
כבר שולח
כבר שולח
מקווה שכתבתי מספיק ברור
import java.util.scanner;
public class reversenumber {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number to reverse: ");
int number = scanner.nextint();
int reversednumber = 0;
while (number != 0) {
int digit = number % 10;
reversednumber = reversednumber * 10 + digit;
number /= 10;
}
system.out.println("the reversed number is: " + reversednumber);
}
}
import java.util.scanner;
public class reversenumber {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number to reverse: ");
int number = scanner.nextint();
int reversednumber = 0;
while (number != 0) {
int digit = number % 10;
reversednumber = reversednumber * 10 + digit;
number /= 10;
}
system.out.println("the reversed number is: " + reversednumber);
}
}
שואל השאלה:
די תסתום תפה תודה אני מאוהבת בך
די תסתום תפה תודה אני מאוהבת בך
אנונימית
^
לא אשקר, אני מבולבל חחח
לא אשקר, אני מבולבל חחח
שואל השאלה:
מה הסיכוי שאתה עוזר לי בעוד משהו?
מה הסיכוי שאתה עוזר לי בעוד משהו?
אנונימית
^
בטח (:
בטח (:
שואל השאלה:
אני מרגישה מזה רעה להפיל את זה עליך כי יש לי כמה אבל מזה תודה זה כאילו זה
אני מרגישה מזה רעה להפיל את זה עליך כי יש לי כמה אבל מזה תודה זה כאילו זה
קישורים מצורפים:
אנונימית
^
לא צריך להרגיש רע חחח
זה התשובה לשאלה 8 (כבר אעשה את השאר):
import java.util.arrays;
import java.util.collections;
import java.util.scanner;
public class largestnumberfromdigits {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number: ");
string number = scanner.next();
character[] digits = new character[number.length()];
for (int i = 0; i < number.length(); i++) {
digits[i] = number.charat(i);
}
arrays.sort(digits, collections.reverseorder());
stringbuilder largestnumber = new stringbuilder();
for (char digit : digits) {
largestnumber.append(digit);
}
system.out.println("the largest possible number is: " + largestnumber);
}
}
לא צריך להרגיש רע חחח
זה התשובה לשאלה 8 (כבר אעשה את השאר):
import java.util.arrays;
import java.util.collections;
import java.util.scanner;
public class largestnumberfromdigits {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number: ");
string number = scanner.next();
character[] digits = new character[number.length()];
for (int i = 0; i < number.length(); i++) {
digits[i] = number.charat(i);
}
arrays.sort(digits, collections.reverseorder());
stringbuilder largestnumber = new stringbuilder();
for (char digit : digits) {
largestnumber.append(digit);
}
system.out.println("the largest possible number is: " + largestnumber);
}
}
התשובה לשאלה 9:
import java.util.scanner;
public class divisibilitycheck {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number: ");
int number = scanner.nextint();
if (number % 7 == 0 && number % 13 != 0) {
system.out.println("the number is divisible by 7 but not by 13.");
}
else if(number % 13 == 0 && number % 7 != 0) {
system.out.println("the number is divisible by 13 but not by 7.");
}
else if(number % 7 == 0 && number % 13 == 0) {
system.out.println("the number is divisible both by 7 and by 13.");
}
else {
system.out.println("the number does not meet the condition.");
}
}
}
import java.util.scanner;
public class divisibilitycheck {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a number: ");
int number = scanner.nextint();
if (number % 7 == 0 && number % 13 != 0) {
system.out.println("the number is divisible by 7 but not by 13.");
}
else if(number % 13 == 0 && number % 7 != 0) {
system.out.println("the number is divisible by 13 but not by 7.");
}
else if(number % 7 == 0 && number % 13 == 0) {
system.out.println("the number is divisible both by 7 and by 13.");
}
else {
system.out.println("the number does not meet the condition.");
}
}
}
תשובה לשאלה 10:
import java.util.scanner;
public class calculatescore {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
int totalscore = 0;
for (int i = 1; i <= 10; i++) {
system.out.println("enter 1 if answer " + i + " is correct, 0 otherwise: ");
int answer = scanner.nextint();
if (answer == 1) {
totalscore += 8;
}
}
system.out.println("enter the number of additional questions answered correctly: ");
int additionalcorrectanswers = scanner.nextint();
totalscore += additionalcorrectanswers * 5;
system.out.println("the total score is: " + totalscore);
}
}
import java.util.scanner;
public class calculatescore {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
int totalscore = 0;
for (int i = 1; i <= 10; i++) {
system.out.println("enter 1 if answer " + i + " is correct, 0 otherwise: ");
int answer = scanner.nextint();
if (answer == 1) {
totalscore += 8;
}
}
system.out.println("enter the number of additional questions answered correctly: ");
int additionalcorrectanswers = scanner.nextint();
totalscore += additionalcorrectanswers * 5;
system.out.println("the total score is: " + totalscore);
}
}
תשובה לשאלה 11:
import java.util.scanner;
import java.util.hashmap;
import java.util.linkedhashmap;
import java.util.map;
import java.util.stream.collectors;
public class electionresults {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
map<string, integer> votes = new hashmap<>();
votes.put("avner", 0);
votes.put("beni", 0);
votes.put("gadi", 0);
system.out.println("enter votes for avner: ");
votes.put("avner", scanner.nextint());
system.out.println("enter votes for beni: ");
votes.put("beni", scanner.nextint());
system.out.println("enter votes for gadi: ");
votes.put("gadi", scanner.nextint());
map<string, integer> sortedvotes = votes.entryset()
.stream()
.sorted((e1, e2) -> e2.getvalue().compareto(e1.getvalue()))
.collect(collectors.tomap(
map.entry::getkey,
map.entry::getvalue,
(e1, e2) -> e1,
linkedhashmap::new
));
int rank = 1;
for (map.entry<string, integer> entry : sortedvotes.entryset()) {
system.out.println("rank " + rank + ": " + entry.getkey() + " with " + entry.getvalue() + " votes");
rank++;
}
}
}
import java.util.scanner;
import java.util.hashmap;
import java.util.linkedhashmap;
import java.util.map;
import java.util.stream.collectors;
public class electionresults {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
map<string, integer> votes = new hashmap<>();
votes.put("avner", 0);
votes.put("beni", 0);
votes.put("gadi", 0);
system.out.println("enter votes for avner: ");
votes.put("avner", scanner.nextint());
system.out.println("enter votes for beni: ");
votes.put("beni", scanner.nextint());
system.out.println("enter votes for gadi: ");
votes.put("gadi", scanner.nextint());
map<string, integer> sortedvotes = votes.entryset()
.stream()
.sorted((e1, e2) -> e2.getvalue().compareto(e1.getvalue()))
.collect(collectors.tomap(
map.entry::getkey,
map.entry::getvalue,
(e1, e2) -> e1,
linkedhashmap::new
));
int rank = 1;
for (map.entry<string, integer> entry : sortedvotes.entryset()) {
system.out.println("rank " + rank + ": " + entry.getkey() + " with " + entry.getvalue() + " votes");
rank++;
}
}
}
תשובה לשאלה 12:
import java.util.scanner;
public class checkdigitsumequality {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a 4-digit number: ");
int number = scanner.nextint();
if (number < 1000 || number > 9999) {
system.out.println("invalid input. please enter a 4-digit number.");
return;
}
int thousands = number / 1000;
int hundreds = (number / 100) % 10;
int tens = (number / 10) % 10;
int units = number % 10;
if (thousands + hundreds == tens + units) {
system.out.println("the sum of the thousands and hundreds digits is equal to the sum of the tens and units digits.");
} else {
system.out.println("the sum of the thousands and hundreds digits is not equal to the sum of the tens and units digits.");
}
}
}
import java.util.scanner;
public class checkdigitsumequality {
public static void main(string[] args) {
scanner scanner = new scanner(system.in);
system.out.println("enter a 4-digit number: ");
int number = scanner.nextint();
if (number < 1000 || number > 9999) {
system.out.println("invalid input. please enter a 4-digit number.");
return;
}
int thousands = number / 1000;
int hundreds = (number / 100) % 10;
int tens = (number / 10) % 10;
int units = number % 10;
if (thousands + hundreds == tens + units) {
system.out.println("the sum of the thousands and hundreds digits is equal to the sum of the tens and units digits.");
} else {
system.out.println("the sum of the thousands and hundreds digits is not equal to the sum of the tens and units digits.");
}
}
}
שואל השאלה:
תודהה הצלת לי את חיים מבטיחה לך
תודהה הצלת לי את חיים מבטיחה לך
אנונימית
^
חחח בכיף (:
חחח בכיף (:
אליקופטר אתה מלך
אני לא צריך את זה גם או משהו פשוט רציתי שתדע שאתה מלך
אני לא צריך את זה גם או משהו פשוט רציתי שתדע שאתה מלך
^
חחח תודה, אבל אני לא, סך הכל עניתי על כמה שאלות
חחח תודה, אבל אני לא, סך הכל עניתי על כמה שאלות
שואל השאלה:
אוף נו מה אתה מצטנע
אוף נו מה אתה מצטנע
אנונימית
^
חחח באמת זה היה סך הכל כמה שאלות
חחח באמת זה היה סך הכל כמה שאלות
גם אם זה פשוט לרמה שלך לשבת לכתוב קוד לוקח זמן וזה לא תמיד דבר כיף ואתה עשית את זה לאיזה 5 שאלות או לאדע כמה אז תקבל את המחמאה
^
חחח טוב נקח את זה כמחמאה, תודה
חחח טוב נקח את זה כמחמאה, תודה
שואל השאלה:
^^ ממש מסכימה
^ ומה אתה מצטנע
^^ ממש מסכימה
^ ומה אתה מצטנע
אנונימית
^
חחח סליחה, תודה
חחח סליחה, תודה
באותו הנושא: