Answer:
I highly recommened you use ggl charts.
Explanation:
It's free. ALL YOU NEED IS AN GGL ACCOUNT. You can also choose many types of graph you want.
Answer:
import java.util.Scanner;
public class HollowSquare
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
int size;
System.out.print("Enter the size : ");
size = scan.nextInt();
if(size>=1 && size<=20)
{
for(int i=0; i<size; i++)
{
for(int j=0; j<size; j++)
{
if(i==0 || j==0 || i==size-1 || j==size-1)
System.out.print("*");
else
System.out.print(" ");
}
System.out.println();
}
}
else
System.out.println("Invalid size.");
}
}
Following are the code in java to reverse any string without using reverse function.
import java.util.*; // import package
class Main // class
{
public static void main(String args[]) // main class in java
{
String s, r = ""; // string variable
Scanner out = new Scanner(System.in); // scanner classes to take input
System.out.println("Enter a string to reverse");
s = out.nextLine(); // input string
int l1 = s.length(); // finding length of string
l1=l1-1;
for ( int i = l1 ; i >= 0 ; i-- ) // for loop to reverse any string
{
r = r + s.charAt(i);
}
System.out.println(" The Reverse String is: "+r); // print reverse string
}
}
Explanation:
firstly we input any string ,finding the length of that string then after that iterating over the loop by using for loop and last display that reverse string
output
Enter a string to reverse
san ran
The Reverse String is: nar nas
Answer:
public class Main{
public static void main(String[] args) {
//The While Loop
int i = 1;
int sum = 0;
while(i <=10){
sum+=i;
i++; }
System.out.println("Sum: "+sum);
//The for Loop
int summ = 0;
for(int j = 1;j<=10;j++){
summ+=j; }
System.out.println("Sum: "+summ); } }
Explanation:
The while loop begins here
//The While Loop
This initializes the count variable i to 1
int i = 1;
This initializes sum to 0
int sum = 0;
This while iteration is repeated until the count variable i reaches 10
while(i <=10){
This calculates the sum
sum+=i;
This increments the count variable i by 1
i++; }
This prints the calculated sum
System.out.println("Sum: "+sum);
The for loop begins here
//The for Loop
This initializes sum to 0
int summ = 0;
This iterates 1 through 10
for(int j = 1;j<=10;j++){
This calculates the sum
summ+=j; }
This prints the calculated sum
System.out.println("Sum: "+summ); }