Java Bangla Tutorials 57 : sum of digits (practical)

preview_player
Показать описание
➡️ In this video, I will explain how to calculate the sum of digits in practical.
⭐️ Video Contents ⭐️
⌨️ (00:00) Intro
⌨️ (00:12) sum of digits
⌨️ (03:058) outro

🛑 Web development? Checkout following playlists :

🛑 Programming languages? Check out the following playlists:

🛑 Android development? Check out the following playlists:

🛑 HSC Students? Are you worried about ICT? I have created 377 videos for you. check out the following playlists-

🛑 CSE Students? Checkout following playlists :

🛑 MS Office? Trying to learn MS office to improve your skill? Checkout following playlists :

#java #anisul_islam #java_bangla_tutorial #web_development #bangla_web_development #andorid #javaprogramming #javatutorial #bangla_tutorial #java_anisul_islam
Рекомендации по теме
Комментарии
Автор

package day1;

import java.util.Scanner;


public class SumOfDigits {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int sum =0, num, temp, rem;
System.out.print("Enter any Number : ");
num = input.nextInt();
temp = num ;
while(temp!= 0){
rem = temp % 10 ;
sum = sum + rem ;
temp = temp / 10 ;
}
System.out.println("Sum of the Didits is : "+sum);
}
}

tomabanik
Автор

package javaaplication;

import java.util.Scanner;

public class SumofDigit {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n, temp, sum = 0, reminder;

System.out.println("enter any number");
n = input.nextInt();
temp = n;

while (temp != 0) {
reminder = temp % 10;
sum = sum + reminder;
temp = temp / 10;

}
System.out.println("The sum of digit is : " + sum);
}
}

nishatsultana
Автор

sir, , ,
c programing err playlist eee apni vol boshoto
sum of digits (practical) upload diechen, , , ,

kindly (theory) part taa add koren

Mehedihasan-lyjv
Автор

package startjava;

import java.util.Scanner;


public class SumOfDigit {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num, sum = 0, temp, reminder;
System.out.print("Enter any number : ");
num = input.nextInt();
temp = num;
while(temp!=0)
{
reminder = temp%10;
sum = sum + reminder;
temp = temp/10;
}
System.out.print("Sum of digit = "+sum);

}

}

sitanath
Автор

sir, ai while loper condition te keno(temp!=0) babohar holo. ar aita to amone likhle(temp==0) keno result ashe na.

fahimsium
Автор

package secondhomework;

import java.util.Scanner;

public class SumOfDigit {

public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num;
System.out.print("Enter any number : ");
num = input.nextInt();
int rem, temp, sum = 0;
temp = num;
while (temp != 0) {
rem = temp % 10;
sum = sum + rem;
temp = temp / 10;
}
System.out.println(sum);

}

}

elorabarua
Автор

ভাইয়া আমি যদি ১০টা বা তার বেশি ডিজিট ইনপুট নেই, তাহলে error! আসে। আমি ডাটা টাইপ long ব্যাবহার করার পরও error আসে। বুঝতে পারছি না কেন।

MilitaryFootageArchive
Автор

input value temporary variable er moddeh kno rakhte hobe?

ibrahimkhalil
Автор

while chara for loop die kora jabe na?
package basicjava2;

import java.util.Scanner;


public class keaword {
public static void main(String[] args) {
int sum=0, r, temp;
Scanner input = new Scanner (System.in);
int num=input.nextInt();
temp=num;

for (int i =temp; i >= temp; i++) {
if(temp!=0){

r=temp%10;
sum=sum+r;
temp=temp/10;
}

}
System.out.println("sum of digits "+ sum);

}


}

tihanysat
Автор

@Anisul Islam vai...10 dia keno devide korlam?? onno kono digit noy keno?

tareqsqatech
Автор

স্যার,
নাম্বারের মাঝে যদি আমি শুন্য ব্যাবহার করি{eg. 5105} তাইলে ভুল ভ্যালু আউটপুট দেয়। এখন কি করব?

LotifurRahman
Автор

package beginnerjava;

import java.util.Scanner;

public class SumOfDigits {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);

System.out.print("Enter any integer number: ");
int num=input.nextInt();
int temp=num, sum=0, rem;

for (; temp!=0;) {
rem=temp%10;
sum+=rem;
temp/=10;
}
System.out.println("Sum is "+sum);
}

}

mdrajib
Автор

import java.util.*;
public class AssignmentJava {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
// Sum of digits
int sum = 0, r, temp, num;
System.out.print("Enter any number: ");
num = sc.nextInt();

temp = num;

while(temp != 0) {
r = temp % 10;
sum = sum + r;
temp = temp / 10;
}

System.out.println("Sum of digits = " + sum);

}
}

msthaque
Автор

initialization, increment karte holo na kano?

suvayansardar
Автор

package sumofdigitdemu;

import java.util.Scanner;

public class SumofDigitDemu {

public static void main(String[] args) {
Scanner input=new Scanner(System.in);
int num, sum=0, r, temp, i;
System.out.println("ENTER ANY POSSITIVE NUMBER : ");
num=input.nextInt();
temp=num;

// while(temp!=0)
//
// {
// r=temp%10;
// sum=sum+r;
// temp=temp/10;
// }
//
for(i=temp;i!=0;i++)
{
r=temp%10;
sum=sum+r;
temp=temp/10;

}
System.out.println("SUM OF DIGIT IS : "+sum);


}

}
bhai jodi for loop chalai ta hola to hoy na ...kn? please aktu bolban?

atanusaha
Автор

package ControlStatement;

import java.util.Scanner;


public class SumOfDigit {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int n, r, temp, sum=0;
System.out.print("Enter number: ");
n=input.nextInt();
temp=n;
while(temp!=0){
r=temp%10;
sum+=r;
temp/=10;
}
System.out.println("Sum: "+sum);
}

}

mhs_