هذا كودي بس الجهاز مو راضي يسوي لي رن ماعرف اش المشكلة
import java.util.Scanner;
public class Sentence{
public static void main(String [] args){
Scanner input=nw Scanner (System.in);
long Sentence=input.nextLong;
if(sentence end with question mark) && (sentence contain even number)
System.out.println("Yes");
if(sentence end with question mark) && (sentence contain odd number)
System.out.println("No");
else if(sentence end with exclamation)
System.out.println("Wow");
else
System.out.println("you always say followed by the input ");
|
اكيد ما راح يشتغل..
انتي فهمتي فكرة السؤال.. الان عليك تحويله الى اكواد.. لانه البرامج لا تفهم مثل ما نحن نفهم..
فا لازم تعملي شغلات بالاكواد
عندك مثلا في الداله الشرطية.
لو بدك تتحقق من شي لابد القيام بامور حتى تكون مفمهومه لدا النظام..
تفضلي الكود
كود PHP:
import java.util.Scanner;
public class One{
public static void main(String[] args)
{
String input;
Scanner keyboard = new Scanner(System.in);
System.out.print(" Enter a sentence: ");
input = keyboard.next();
if(input.substring(input.length()-1).equals("?") && input.length()%2==0)
System.out.print(" Yes ");
else if(input.substring(input.length()-1).equals("?") && input.length()%2!=0)
System.out.print(" No ");
else if(input.substring(input.length()-1).equals("!"))
System.out.print(" Wow ");
else
System.out.print(" You always say \"" + input + "\"");
}
}
هو مو 100%
لكن انا اللي فهمت من السؤال انه الاحرف تكون عدد زوجي..
هنا يتم حساب ال ؟ ضم عدد الاحرف
يعني لو وضعتي 7 حرف مع ؟ = 8
جربي تضغي
ooooooo?
+
oooooo?
بالتوفيق لك