# Web Development

## General discussion

Locked

By ·
the program takse from the user any number between 0 - 32767 and displays it in a written form , then calcu;ates the sum of digits, and find the min and max numbers

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

Collapse -

try this: [java]
JTextField tf;
String input=tf.getText();
Integer[] ia=new Integer[input.length()];
int[] inta=new int[ia];
for(int i=0;i<ia.length;i++){
inta=ia.intvalue();
}
..so you now have an array of int which you can find sum,min,max.
I find it difficult to imagine the practical application of this though

Collapse -

### an answer in c

/* a possible solution in tc3*/
*By MMM
*Hope this will solve your problem
*/

#include<stdio.h>
#include<conio.h>

void main()
{
int sum,min,max,numIn,num[],i=0;

printf("Enter a value between 0 and 32767: ");
scanf("%d, &num);//user input

//if invalid input....
//take input again
while(num<=0 || num>32767)
{
printf("Enter a value between 0 and 32767: ");
scanf("%d, &num);
}

while(num>0 && num<32767)
{
num=num%10;
sum+=num;
min=num[0];
max=num[0];
if(num<min)min=num;
if(num>max)max=num;
++i;
num/=10;

}
printf("The sum of %d digits is : ",i,sum);
printf("The max digit is : ",max);
printf("The min digit is : ",min);

getch();
}

## Related Discussions

• 12

• 23

#### A cheat sheet: How to become a developer

• 1

nihitthakkar ·

• 11

#### Latest Programming Language

iDeveloperworld ·

• 3

#### How can I get high quality backlinks and improve my website rank?

Affiliatelance ·