DEV Community

hema latha
hema latha

Posted on

while loop programes - sum and count

package day1;

public class Task {

public static void main(String[] args) {
    // TODO Auto-generated method stub

int no = 12345678;
int count = 0;
int sum = 0;
while(no>0)
{
    sum = sum + no%10;
    no=no/10;
    count = count+1;}
System.out.println(sum);
System.out.println(count);




}}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series 📺

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series 👀

Watch the Youtube series