F&A Diskussionen
What is the output and why? 
public static int[] make (int n){
int[]a=new int [n];
a [i]=i+1;
}
return a;
}
public static void dub (int []jub){
for (intent i=0;i <jub.length;i++){
jub*=2;
}
}
public static int mus (int []zoo){
int jus=0;
for (int i=0;i <zoo.length;i++){
jus+=zoo [i];
}
return jus;
}
public static void main  (String [] args){
int [] bob =make(5);
dub (bob);
System.out.println (mus (bob));
}
 0 Stimmen
 2 Antwortenusing System;
namespace GoodProgrammerTest 
{
class Program 
{
static void Main(string[] args) 
{
Console.Write("Enter Yes or No");
Console.Write(
"Do you programme every day? : ") ;
int answer = Console.ReadLine();
if (answer =="Yes") 
{
Console.WriteLine(
"You will be a good programmer");
} 
else
{
Console.WriteLine(
"You will not be a good programmer");
} 
} 
} 
} 
 2 Stimmen
 3 Antwortenporqué el cierre de un parrafo es }
 0 Stimmen
 1 Antwortwhy does this code output  that there is an error because the else statement doesn't have a corresponding if statement?. How do i correct this?
#include <iostream>
using namespace std;
int main() {
int a;
for (int x =0; x<5;x++){
cin>>a;
if (a<1){
   cout<<"a cannot be less than 1\n";
  }
   else if (a>10){
   cout <<"a cannot be greater than 10\n";
}
}
else{
   cout<<"code can run now"<<endl;
}
    return 0;
}
 3 Stimmen
 8 AntwortenHeute heiß
Beginner question
 0 Votes
I need help to solve this
 0 Votes
Remove
 0 Votes
Project
 0 Votes
Engineer Cloud
 0 Votes
Lua?
 1 Votes