Computer Science, asked by mehtalalita26, 1 year ago

what is wrong in this program of java (written in bluej) :
import java.util.Scanner;
public class v
{
public static void main()
{
int k=0,n=1;
int sum=0;
Scanner s=new Scanner(System.in);
System.out.println("enter number");
String m=s.next();
int a=m.length();
System.out.println(a);
k=a-1;
for(n=1;n<=a;n=n+1)
{
k=a-n;
char z=m.charAt(k);
sum=sum+z;
}
System.out.println("total sum"+sum);
}
}

(in the answer 48 gets automatically added)
please answer if you know
THANKS


nitish8089: What are you giving input.
nitish8089: ya...
mehtalalita26: giving any input will add 48
nitish8089: sum=sum(int)+z(char)..
mehtalalita26: still error is there

Answers

Answered by ramansinghji6
0

Answer:

Aur thoda bada question puch lo

Similar questions