[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-718167-105":59,"doc-detail-718167-en":130,"doc-similar-718167":162},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","java-programs-java-practice-number-patterns-and-arithmetic-tasks","JAVA PROGRAMS - Java Practice - number patterns and arithmetic tasks","","A collection of Java programming exercises implementing basic numeric algorithms using console input/output. The programs compute odd-number listings, sums and counts of odd values, sums of the first n integers, and digit-sum for a number. Additional tasks include electricity bill calculation using conditional branching, Armstrong number checks and range generation, converting numbers to words, palindrome detection and enumeration, prime-number generation with sum/average intent, and multiple star/number pattern printing examples using nested loops.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/java-programs-java-practice-number-patterns-and-arithmetic-tasks/718167/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/java-programs-java-practice-number-patterns-and-arithmetic-tasks/718167.png","ImageObject",300,407,{"name":92,"@type":93},"Asher","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-21","2026-11-16",true,{"@type":102,"interactionType":103,"userInteractionCount":14},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"Which exercises compute odd numbers between 1 and 100?","Question",{"text":112,"@type":113},"The collection includes programs to display odd numbers between 1–100, as well as to calculate the sum and the total count of those odd numbers.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How does the electricity bill program determine the bill amount?",{"text":117,"@type":113},"It uses nested if-else conditions based on the units consumed, applying different multipliers depending on the units range, then prints units and total bill.",{"name":119,"@type":110,"acceptedAnswer":120},"What kinds of pattern-printing examples are included?",{"text":121,"@type":113},"The document contains multiple console pattern programs that print pyramids and star arrangements using nested loops and fixed or adjustable sizes.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},718167,1794855123,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":14,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":19,"preview_urls":145},687197207639,"https://ap-avatar.wpscdn.com/davatar_a8503ba1806abce46bf441b54a3ca4cd","JAVA PROGRAMS  \nDisplay odd numbers between 1-100  \nclass OddNumber {  \npublic static void main(String args[]) {  \nSystem.out.println(\"The Odd Numbers are:\");  \nfor (int i = 1; i \u003C= 100; i++) {  \nif (i % 2 != 0) {  \nSystem.out.print(i + \" \");  \n}  \n}  \n}  \n}  \nSum of odd numbers between 1-100  \nclass SumOfNum {  \npublic static void main(String args[])  \n{  \nint sum = 0;  \nfor (int i = 1; i \u003C= 100; i++)  \n{  \nif (i % 2 != 0)  \n{  \nsum = sum + i;  \n}  \n}  \nSystem.out.println(\"The Sum Of 100 Odd Numbers are:\" + sum);}  \n}  \nTotal number of odd numbers between 1-100  \nclass TotalNumOfOddNum {  \npublic static void main(String args[])  \n{  \nint count = 0;  \nfor(int i = 1;i \u003C= 100;i++)  \n{  \nif(i % 2 != 0)  \n{  \ncount++;  \n}  \n}  \nSystem.out.println(\"The Count Of Odd Numbers are:\" + count);}  \n}  \nFind sum of first n numbers  \nclass SumOfNum {  \npublic static void main(String args[])  \n{  \nint sum = 0;  \nint n=10;  \nfor(int i = 1;i \u003C= n;i++)  \n{  \nsum = sum + i;  \n}  \nSystem.out.println(\"The Sum Of \"+n+\" Numbers are:\" + sum);}  \n}  \nFind the sum of the digits of a number  \npublic class DigitsSum {  \npublic static void main(String[] args)  \n{  \nint num=251025, rem = 0, sum = 0, temp;  \ntemp = num;  \nwhile (num > 0)  \n{  \nrem = num % 10;  \nsum = sum + rem;  \nnum = num / 10;  \n}  \nSystem.out.print(\"Sum of Digits of \" + temp + \" is \" + sum);}  \n}  \nCalculate electricity bill  \npublic class ElectricBill {  \npublic static void main(String args[])  \n{  \nint units = 123;  \nint bill = 0;  \nif (units > 100)  \n{  \nif (units >= 200)  \n{  \nif (units > 300)  \n{  \nbill = units * 8;  \n}  \nelse  \nbill = units * 6;  \n}  \nelse  \nbill = units * 5;  \n}  \nSystem.out.println(\"CHENNAI ELECTRICITY LTD, CHENNAI\");  \nSystem.out.println(\"Units Consumed : \" + units);  \nSystem.out.println(\"Total Bill : \" + bill);  \n}  \n}  \nJava program to find Armstrong number  \npublic class ArmstrongNumber {  \npublic static void main(String args[])  \n{  \nint n, arg, sum = 0, r;  \nn = 153; // input value  \narg = n;  \nfor (int i = 1; i \u003C n; i++)  \n{  \nwhile (n > 0)  \n{  \nr = n % 10;  \nsum = sum + (r * r * r);  \nn = n / 10;  \n}  \n}  \nif (arg == sum)  \n{  \nSystem.out.println(\"Given number is armstrong number: \" + arg);}  \nelse  \n{  \nSystem.out.println(\"Given number is not armstrong number: \" + arg);}  \n}  \n}  \nProgram to print Armstrong number between 1 to 1000  \npublic class ArmstrongNumbers {  \npublic static void main(String[] args)  \n{  \nint num,rem,limit=1000, sum = 0;  \nSystem.out.print(\"Armstrong numbers from 1 to N:\");  \nfor (int i = 1; i \u003C= limit; i++)  \n{  \nnum = i;  \nwhile (num > 0)  \n{  \nrem = num % 10;  \nsum = sum + (rem*rem*rem);  \nnum = num / 10;  \n}  \nif (sum == i)  \n{  \nSystem.out.print(i + \" \");  \n}  \nsum = 0;  \n}  \n}  \n}  \nPrint given number in words  \npublic class NumberToWords {  \npublic void pw(int n, String ch)  \n{  \nString one[] = { \" \", \" One\", \" Two\", \" Three\", \" Four\", \" Five\", \" Six\", \" Seven\", \" Eight\", \"Nine\", \" Ten\",\" Eleven\", \" Twelve\", \" Thirteen\", \" Fourteen\", \"Fifteen\", \" Sixteen\", \" Seventeen\",\" Eighteen\",\" Nineteen\" };  \nString ten[] = { \" \", \" \", \" Twenty\", \" Thirty\", \" Forty\", \" Fifty\", \" Sixty\", \"Seventy\", \" Eighty\",\" Ninety\" };  \nif (n > 19)  \n{  \nSystem.out.print(ten[n / 10] + \" \" + one[n % 10]);}  \nelse  \n{  \nSystem.out.print(one[n]);  \n}  \nif (n > 0)  \nSystem.out.print(ch);  \n}  \npublic static void main(String[] args)  \n{  \nint n=28;  \nSystem.out.print(n);  \nif (n \u003C= 0)  \n{  \nSystem.out.println(\"Enter numbers greater than 0\");}  \nelse  \n{  \nNumberToWords a = new NumberToWords();  \n[a.pw](a.pw)((n / 1000000000), \" Hundred\");  \n[a.pw](a.pw)((n / 10000000) % 100, \" crore\");  \n[a.pw](a.pw)(((n / 100000) % 100), \" lakh\");  \n[a.pw](a.pw)(((n / 1000) % 100), \" thousand\");  \n[a.pw](a.pw)(((n / 100) % 10), \" hundred\");  \n[a.pw](a.pw)((n % 100), \" \");  \n}  \n}  \n}  \nProgram to check the given number is Palindrome or not  \npublic class PalindromeNumberCheck {  \npublic static void main(String[] args)  \n{  \nint n=121,pal,r,rev=0;  \npal = n;  \nwhile (n > ","cbCaitR6NNLWY0dP","https://ap.wps.com/l/cbCaitR6NNLWY0dP","pdf",258931,35,"English","# Odd-number tasks\n## Sum and count of odd numbers\n## First n number sum\n## Digit sum of a number\n# Conditional calculation\n## Electricity bill calculation\n# Number theory and checks\n## Armstrong number\n## Palindrome number\n## Prime number generation\n# String/format output\n## Number to words\n# Pattern printing\n## Pyramid and star patterns","[{\"question\":\"Which exercises compute odd numbers between 1 and 100?\",\"answer\":\"The collection includes programs to display odd numbers between 1–100, as well as to calculate the sum and the total count of those odd numbers.\"},{\"question\":\"How does the electricity bill program determine the bill amount?\",\"answer\":\"It uses nested if-else conditions based on the units consumed, applying different multipliers depending on the units range, then prints units and total bill.\"},{\"question\":\"What kinds of pattern-printing examples are included?\",\"answer\":\"The document contains multiple console pattern programs that print pyramids and star arrangements using nested loops and fixed or adjustable sizes.\"}]","JAVA PROGRAMS - Java Practice - number patterns and arithmetic tasks | PDF",88,[146,150,154,158],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/4330cd773ca94dfa880ffce067f4e4cb.webp",983,1272,{"page_no":14,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/564aa88a35b85ec1979e1a34f9456ce4.webp",982,1270,{"page_no":81,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/78aaf7c9d3beef63cf69b76b1b86bbb5.webp",981,1269,{"page_no":19,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-17/2fe611a4fdebf5f145ebcb465123c45b.webp",980,1268,{"list":163,"token":66},[164,170,176,182,188,194,200,206,212,218],{"doc_id":165,"doc_title":166,"file_type":137,"home_preview_img_url":167,"slug":168,"view_count":14,"category_name":30,"create_tm":169},718171,"100+ Java Programs with Output - Useful collection of Java Programs","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230019204754/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=maSqQFmpFgoD00MFi8Fca4prxls%3D","100-java-programs-with-output-useful-collection-of-java-programs",1794855133,{"doc_id":171,"doc_title":172,"file_type":137,"home_preview_img_url":173,"slug":174,"view_count":46,"category_name":30,"create_tm":175},347822,"Introduction to Programming Using Java - Version 9 - Swing Edition","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911558026/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=p9fb%2BqxatvfTCgJlJ%2FInQqzgPNc%3D","introduction-to-programming-using-java-version-9-swing-edition",1790069250,{"doc_id":177,"doc_title":178,"file_type":137,"home_preview_img_url":179,"slug":180,"view_count":19,"category_name":30,"create_tm":181},697704,"Introduction to Programming in C++ - Algorithms, Flowcharts and Pseudocode","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009856755/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=g1tGd84LhuTIKXV0yOqJA41c7Gs%3D","introduction-to-programming-in-c-algorithms-flowcharts-and-pseudocode",1794442290,{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":187,"category_name":30,"create_tm":175},347823,"JAVA for Beginners - 2nd Edition - An introductory course for Advanced IT Students and those who would like to learn the Java programming language","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229911558027/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=VGtTJsF46L0367D0gSkc3rIGqag%3D","java-for-beginners-2nd-edition-an-introductory-course-for-advanced-it-students-and-those-who-would-like-to-learn-the-java-programming-language",13,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":81,"category_name":30,"create_tm":193},671829,"For Loop Chess Board - Make it print a chess board","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229988408535/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=UcylFwBfemtU1IBQW%2FrjRsHOEmQ%3D","for-loop-chess-board-make-it-print-a-chess-board",1793581238,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":81,"category_name":30,"create_tm":199},700989,"The Java Native Interface - Programmer’s Guide and Specification","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012045673/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=WOLMbSYnhUAO%2BmFC7b5zeWmWcYo%3D","the-java-native-interface-programmers-guide-and-specification",1794522639,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":34,"category_name":30,"create_tm":205},655582,"The UML Class Diagram - Class Diagram Basics - 2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229974775251/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=LLSz18It5OMP2ksBMtDzD%2FjaShI%3D","the-uml-class-diagram-class-diagram-basics-2",1792962726,{"doc_id":207,"doc_title":208,"file_type":137,"home_preview_img_url":209,"slug":210,"view_count":19,"category_name":30,"create_tm":211},701153,"Selenium + JUnit 5 - The Perfect Match - Meetup 2021","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012051883/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=sb4EDzpgtXUnX%2FsYxj2PpCLrWiw%3D","selenium-junit-5-the-perfect-match-meetup-2021",1794523807,{"doc_id":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":24,"category_name":30,"create_tm":217},685631,"Introduction to List - List Operations - Traversing a List - List Methods and Built-in Functions","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999084036/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=Oxd67DRRcLR82CIJf8%2BaMczjuig%3D","introduction-to-list-list-operations-traversing-a-list-list-methods-and-built-in-functions",1794016095,{"doc_id":219,"doc_title":220,"file_type":137,"home_preview_img_url":221,"slug":222,"view_count":223,"category_name":30,"create_tm":224},655696,"Visual Paradigm Handbook - Sequence Diagram - Overview of UML Sequence Diagram Concepts","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229975288090/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111939&Signature=NsAouP5Pl2kVfnDjvDCZfbpOAAQ%3D","visual-paradigm-handbook-sequence-diagram-overview-of-uml-sequence-diagram-concepts",12,1792963364]