2 replies
by obadare
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
by mmmova
/* a possible solution in tc3*/
*By MMM
*Hope this will solve your problem
*/
#include
#include
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[i]=num%10;
sum+=num[i];
min=num[0];
max=num[0];
if(num[i]max)max=num[i];
++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();
}
This discussion is closed to new replies.
Trending Web Development posts
Sort by Trending