Computer Science, asked by geniuskhushi32, 4 months ago

tell this project answers​

Attachments:

Answers

Answered by purvanshsharma6
1

Answer:

1. import java.util.*;

public class prog{

public static void main(String args[]){

Scanner sc = new Scanner(System.in);

System.out.println("Enter the first no :");

int n = sc.nextInt();

System.out.println("Enter the second no :");

int num = sc.nextInt();

If(n<=num)

System.out.println(num+"Is greater than"+n+ "\n");

else

System.out.println(n+"Is greater than"+num+ "\n");

}

}

2. import java.util.*;

public class Demo

{

   public static void main(String[] args)  

   {

       System.out.println("Enter any no :");

int number = sc.nextInt();

       if(number > 0)

       {

           System.out.println(number+" is a positive number");

       }

       else if(number < 0)

       {

           System.out.println(number+" is a negative number");

       }

       else

       {

           System.out.println(number+" is neither positive nor negative");

       }

   }

}

3. import java.util.*;

public class SquareSeries

{

public static void main(String args[])

{

 int n;

 Scanner sc = new Scanner(System.in);

 System.out.println("Enter no of elements in series: ");

 n = sc.nextInt();

 if(n>0)

 {

  System.out.println("Series:");

  for(int i=0; i<n; i++)

  {

   System.out.println((int)(Math.pow(i,2)));

  }

 }

 else

  System.out.println("You Entered the Wrong no.");

}

}

4. public class series{

public static void main(String args[]){

int n = 11;

for(int i = 1; i<=10;i++){

System.out.print(n*i + ",");

}

}

}

5. public class series2{

public static void main(String args[]){

for(int i = 1; i<=4;i++){

System.out.println();

for(int j = 1; j<=i; j++){

System.out.print("*");

}

}

}

}

Explanation:

Answered by THANISHCHINNAPPA
1

Answer:

Sorry I got syntax error in the first three questions(As I am just 10th grade and you are 12th), however I managed to get the fourth and fifth questions...

4th answer :

a1=11

d=11

n=10

an1=a1+(1-1)*d

an2=a1+(2-1)*d

an3=a1+(3-1)*d

an4=a1+(4-1)*d

an5=a1+(5-1)*d

an6=a1+(6-1)*d

an7=a1+(7-1)*d

an8=a1+(8-1)*d

an9=a1+(9-1)*d

an10=a1+(10-1)*d

print(an1)

print(an2)

print(an3)

print(an4)

print(an5)

print(an6)

print(an7)

print(an8)

print(an9)

print(an10)

5th Answer:

print('*')

print('* *')

print('* * *')

print('* * * *')

Outputs:

For 4th one

11

22

33

44

55

66

77

88

99

110

For 5th one

*

* *

* * *

* * * *

Thank you

Similar questions