The internet is useful because it helps us to be connected to every parts of world, we can know what's happening to other parts of world using internet.
I'm writing that in some sort of pseudocode; if you don't understand it, feel free to ask for more details in the comments.
function sumOdd(n)
if n==1 then
return 1
end if
return (sumOdd(n-1))+(n*2-1)
end function
This is a java program with a class called Sum1.
Explanation:
While loop is used to add 10 number.
import java.util.Scanner;
public class Sum 1
{
public static void main(String args[])
{
int number, count, sum = 0;
Scanner s = new Scanner(System.in);
System.out.print("Enter the number:");
number = s.nextInt();
while(number > 0)
{
count = number % 10;
sum = sum + n;
number = number / 10;
}
System.out.println("Sum of Digits:"+sum);
}
}
54 / 123 =
approximately
0.44:1
width:length