Bu örnekte while döngüsünü kullanarak, kullanıcının girdiği sayının rakamlarının toplamını bulacağız.
Örneğe başlamadan önce Java Dili Basamak Sayısı Bulma sayfasını da ziyaret edebilirsiniz.
package kodbloklari.com;
import java.util.Scanner;
public class RakamToplam {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int toplam = 0;
System.out.println("Bir sayi giriniz: ");
int sayi = scan.nextInt();
while(sayi > 0) {
toplam += sayi % 10;
sayi /= 10; // sayi = sayi / 10;
}
System.out.println("Girilen sayinin rakamlarının toplamı = " + toplam);
}
}
Girilen sayının rakamlarını tek tek elde etmek için while döngüsü kullanıyoruz. Sayının 10’a bölümünden kalanını alıp birler basamağını elde ettikten sonra bu sayıyı toplam değişkenine ekliyoruz.
“%” operatörü bölümünden kalanı bulmamızı sağlar. “sayi % 10” yaptığımız zaman da sayının 10’a bölümünden kalanını verir. Sayının 10’a bölümünden kalanıda birler basamağıdır. Konunun detaylı anlatımı için Java Dili Operatörler sayfasından Aritmetik Operatörleri ziyaret edebilirsiniz.
Daha sonra sayıyı 10’a bölüp bu şekilde sayının tüm rakamlarına erişip toplam değişkenine ekliyoruz.
Örneğin kullanıcı 1923 sayısını girdiği zaman olacak işlemler şöyledir:
(1923 % 10 = 3) , 1923 / 10 = 192 (sayi = 192)
(192 % 10 = 2), 192 / 10 = 19 (sayi = 19)
(19 % 10 = 9) , 19 / 10 = 1 (sayi = 1)
(1 % 10 = 1) , 1 / 10 = 0.1 (sayi = 0.1)
döngü sonlanır. Bu şekilde sayının tüm rakamlarını elde edip toplam değişkenine ekliyoruz. Böylece kullanıcının girdiği sayının rakamlarının toplamını buluyoruz.
Kodun ekran çıktısı da şu şekildedir:

128 Yorum
order fenofibrate 200mg pills brand tricor purchase fenofibrate online cheap
brand tadalafil 5mg order sildenafil 50mg for sale sildenafil us
zaditor 1 mg price order imipramine 25mg for sale order imipramine 75mg generic
purchase mintop sale top ed drugs erectile dysfunction drug
generic precose 25mg acarbose 25mg for sale order griseofulvin sale
aspirin sale buy generic lquin online imiquad brand
buy dipyridamole without a prescription order generic pravastatin 20mg purchase pravastatin online
order dydrogesterone 10 mg generic jardiance 25mg us order jardiance 10mg for sale
buy florinef no prescription imodium 2mg cost brand imodium 2 mg
order generic etodolac 600mg order colospa without prescription order pletal 100 mg for sale
buy generic prasugrel 10 mg dramamine 50 mg without prescription tolterodine 2mg usa
buy ferrous sulfate generic betapace order brand sotalol
order mestinon online cheap buy pyridostigmine 60 mg online rizatriptan 10mg over the counter
buy generic vasotec cheap vasotec 5mg buy duphalac online cheap
xalatan order generic xeloda how to get rivastigmine without a prescription
betahistine ca buy generic betahistine online order benemid 500 mg
omeprazole 20mg pill montelukast 5mg us lopressor 100mg cost
order premarin generic buy sildenafil viagra oral
micardis 80mg tablet order telmisartan 80mg generic order molnupiravir 200mg online cheap
buy cialis 20mg pills oral tadalafil 40mg price viagra
cenforce 100mg pill naprosyn price buy chloroquine sale
buy generic provigil 200mg purchase promethazine online cheap prednisone 10mg generic
cefdinir over the counter omnicef order online cost lansoprazole
accutane 10mg generic purchase azithromycin pill buy zithromax 250mg generic
lipitor 80mg us buy proventil 100mcg online generic amlodipine 10mg
azithromycin 250mg ca order azithromycin 250mg gabapentin 100mg price
roulette casino pala casino online furosemide 100mg pill
protonix 20mg us oral phenazopyridine phenazopyridine 200mg pills
real money casino buy ventolin paypal order generic ventolin 2mg
gambling site play roulette for free ivermectin new zealand
symmetrel 100mg us dapsone 100mg for sale order avlosulfon 100mg online
casino online order synthroid 100mcg without prescription cheap levothroid online
buy methylprednisolone us aristocort for sale buy triamcinolone pills
buy clomiphene 50mg pills buy imdur 40mg imuran 25mg pills
Unibet Casino has such an extensive library of online casino games, players with various tastes and preferences are sure to find what they want. Unibet Casino is one of the most significant iGaming brands in the United States. While others only operate in one or two states, Kindred Group’s online casino has expanded to several jurisdictions in the USA. The company’s combined player base in Europe and the US is estimated at 15 million satisfied customers. Unibet Casino is an online gambling platform that offers a diverse range of casino games, including slots, table games, and live dealer games. It is a part of the Kindred Group, a renowned gambling company known for its commitment to providing a safe and fair gaming environment. Unibet Casino has been operating since 1997 and holds a license from the Malta Gaming Authority, ensuring the highest standards of player protection.
https://doctorbookmark.com/story15107081/compression-molded-poker-chips
Since it has to comprehend a much smaller screen size, the Royal Panda mobile site has a different layout of all menus. For example, in the mobile casino, you can find a “lane” with four options that are located at the bottom of the page: The live casino suite at Roobet is called Roo’s Lounge. You’ll find a total of eight live casino titles powered by Evolution, OneTouch, BGaming, and Pragmatic Play. Roulette, blackjack, and baccarat variations are all hosted through HD streams, presented by professional croupiers, and provide you with the chance to bring that true casino experience to your screens. Royal Panda offers a mobile optimized website in Ontario, allowing anyone aged 19 or older to play hundreds of casino games on a smartphone. However, it does not currently have a Royal Panda Casino app. Ontario players that want to download an app can search for LeoVegas – a sister brand to Royal Panda – on Google Play or the Apple Store.
levitra for sale online order lanoxin generic tizanidine 2mg brand
buy perindopril 4mg generic order clarinex 5mg sale allegra 120mg pills
buy dilantin 100 mg sale ditropan 2.5mg over the counter oxytrol usa
buy lioresal medication generic amitriptyline 50mg purchase toradol online
buy generic loratadine buy claritin without a prescription dapoxetine 30mg for sale
buy ozobax for sale order baclofen 25mg online cheap toradol 10mg oral
buy amaryl online oral glimepiride buy arcoxia 60mg
order alendronate 70mg online cheap order alendronate 70mg for sale brand macrodantin
propranolol without prescription buy propranolol sale order generic plavix
buy nortriptyline 25 mg generic order methotrexate 5mg sale paracetamol order
order coumadin 2mg pills warfarin 5mg tablet metoclopramide 10mg price
order xenical 120mg sale buy generic xenical 120mg cheap diltiazem 180mg
buy famotidine sale hyzaar pills cheap tacrolimus 5mg
order astelin sale irbesartan online order buy generic avapro
buy nexium medication mirtazapine over the counter order topamax 200mg pill
order generic zyloprim 300mg clobetasol over the counter rosuvastatin canada
buy imitrex 25mg pills buy levaquin online cheap avodart medication
buy buspar 10mg online generic zetia amiodarone without prescription
buy ranitidine generic meloxicam 15mg price celebrex uk
buy motilium pills for sale coreg sale tetracycline medication
oral tamsulosin 0.2mg order zocor 20mg pill buy simvastatin generic
buy aldactone 100mg online order propecia 1mg pill proscar 5mg canada
professional letter writing services buy essay now academic writing is
buy generic forcan baycip online order ciprofloxacin 1000mg tablet
buy aurogra generic aurogra 50mg pill estrace 2mg canada
metronidazole 400mg drug cephalexin over the counter order cephalexin 500mg without prescription
lamotrigine for sale buy prazosin without a prescription nemazole for sale
order cleocin 150mg online cheap fildena 50mg ca order sildenafil sale
buy retin cream generic buy avana 100mg online avana 200mg without prescription
order nolvadex 20mg online budesonide allergy spray rhinocort without prescription
tadacip 10mg over the counter buy tadacip pill buy generic indomethacin over the counter
axetil tablet bimatoprost eye drops robaxin usa
desyrel 50mg for sale trazodone 100mg pills clindamycin over the counter
buy terbinafine pills purchase terbinafine online online casino with free signup bonus real money usa
https://withoutprescription.guru/# viagra without a doctor prescription walmart
order aspirin generic casino games online online gambling for real money
research paper help online cefixime 200mg ca buy generic suprax for sale
write my term paper highest rated online casinos usa best no deposit free spins
http://mexicopharm.shop/# medicine in mexico pharmacies
https://edpills.icu/# erection pills viagra online
order amoxicillin for sale oral trimox 500mg order generic macrobid
https://canadapharm.top/# thecanadianpharmacy
order calcitriol 0.25 mg without prescription trandate 100mg canada order fenofibrate 160mg online cheap
http://edpills.monster/# best ed treatment pills
sildenafil online in india 20 mg sildenafil 30 tablets cost sildenafil buy over the counter
tadalafil otc usa cost of tadalafil generic tadalafil generic over the counter
https://sildenafil.win/# buy real sildenafil online with paypal
clonidine 0.1mg pills generic catapres 0.1 mg oral tiotropium bromide 9mcg
Kamagra 100mg Kamagra tablets Kamagra 100mg price
adult acne medication pill best topical acne medication prescription trileptal drug
Những website ứng dụng cho vay tiền online tư nhân thường có tốc độ xét duyệt khoản vay khá ấn tượng, và điều kiện hỗ trợ cũng tương đối dễ dàng. Trong số nhiều dịch vụ tài chính tín dụng đang cung cấp các khoản vay online hiện nay, Vay Siêu Tốc (H5 Vay Siêu Tốc) chính là một giải pháp có được những ưu điểm vừa nói. Để nhận được lãi suất ưu đãi này, khách hàng cần đang tham gia sản phẩm “Vay vốn siêu tốc, phát lộc kinh doanh” của SCB và sử dụng tối thiểu các dịch vụ tại SCB, gồm Ebanking (SMS Banking – tối thiểu 1 số điện thoại, Internet Banking Mobile Banking – tối thiểu 1 user); đã kích hoạt sản phẩm thẻ Credit Debit dành cho khách hàng doanh nghiệp tại SCB.
https://marvelcomics.faith/wiki/Li_sut_ngn_hng_vp
H5 vay tiền là hình thức vay tiền online tiện lợi được rất nhiều khách hàng lựa chọn khi gặp khó khăn về tài chính. Với ưu điểm nhanh chóng, an toàn và sẵn sàng đáp ứng khi bạn cần, các website vay tiền H5 đang dần chiếm được lòng tin của đông đảo người dùng. Không chỉ hỗ trợ vay nhanh, City Credit còn hỗ trợ khách hàng thanh toán nhanh, hoàn thành nghĩa vụ dễ dàng nhất. H5 City Credit sẽ cung cấp cho khách hàng các hình thức toán khoản vay vô cùng đơn giản mà ai cũng có thể sử dụng được: H5 vay 18 tuổi là một hình thức như thế nào? Đâu là ưu, nhược điểm, lãi suất, điều kiện và thủ tục của app vay tiền online này? Bạn sẽ được cập nhật câu trả lời ngay trong bài viết dưới đây của Taichinh.vip nhé!
Kamagra Oral Jelly Kamagra Oral Jelly sildenafil oral jelly 100mg kamagra
sildenafil otc nz how to buy sildenafil sildenafil india buy
https://sildenafil.win/# sildenafil 100mg price uk
minocin cheap buy generic minomycin requip 2mg without prescription
lisinopril 40 mg on line prescription for lisinopril buy cheap lisinopril 40mg
where can i buy doxycycline over the counter: doxycycline buy online – buy doxycycline 100 mg tablet
alfuzosin for sale best generic allergy pills prescription medicine for stomach cramps
buy amoxicillin online with paypal: buy amoxil – amoxicillin 200 mg tablet
where can i get doxycycline over the counter doxycycline buy online where to buy doxycycline online
order zithromax without prescription: zithromax 500mg – zithromax antibiotic without prescription
amoxicillin 500mg capsule cost cheap amoxicillin buying amoxicillin in mexico
buy femara 2.5mg online order generic femara order generic abilify 20mg
zestril tab 10mg: buy lisinopril online – lisinopril 5mg
strongest sleeping pills at walgreens gnc top weight loss pills prescription weight loss pills
where can i buy cipro online ciprofloxacin without insurance ciprofloxacin generic
lisinopril 40: buy lisinopril – lisinopril 20 mg tablets
can you buy doxycycline over the counter in india Buy doxycycline 100mg doxycycline prescription cost uk
generic zithromax medicine: buy zithromax – where to buy zithromax in canada
generic amoxicillin online: how to buy amoxycillin – medicine amoxicillin 500mg
amoxicillin 500mg capsule cost amoxil for sale amoxicillin 500mg capsule
quit smoking aids australia injections for osteoporosis monthly pain drugs listed for strengthen
order provera online oral provera buy hydrochlorothiazide 25mg
online pharmacies reviews: buy drugs online safely – prescription drug prices
pharmacy without dr prescriptions: buy drugs online – verified canadian pharmacy
canadian pharmacy 365: certified canada pharmacy online – canadian pharmacy store
viagra 100mg canadian pharmacy: online pharmacy no prescription – online pharmacy no prescriptions
cheapest online pharmacy india Online medicine order Online medicine home delivery
viagra mexican pharmacy: cheapest online pharmacy – best internet pharmacies
fda approved antiviral drugs diabetes pills list list of diabetic drugs
reputable online canadian pharmacy: buy prescription drugs online – best online pharmacy
buy cyproheptadine paypal buy generic ketoconazole for sale buy ketoconazole paypal
buy wellbutrin online usa: Wellbutrin online with insurance – buy wellbutrin in australia
paxlovid for sale: buy paxlovid – paxlovid pharmacy
buy antifungal pills online strongest antifungal pill how to reduce bp immediately
buy cymbalta 40mg pill modafinil uk order modafinil pills
buy ventolin tablets online: Ventolin HFA Inhaler – where can i order ventolin without a prescription
Paxlovid buy online http://paxlovid.club/# paxlovid pill
can i purchase cheap clomid without rx: Buy Clomid Online Without Prescription – how to get generic clomid tablets
expensive ulcer drugs immediate stomach ulcer pain relief uti treatment guidelines for elderly
Paxlovid over the counter: paxlovid club – paxlovid india
order promethazine without prescription promethazine 25mg us ivermectin 3mg dosage
п»їpaxlovid: Paxlovid without a doctor – buy paxlovid online