Programme Architecture for Adding Odd Numbers between 1 and 10
This program adds odd numbers to a specified range from 1 to 100 by using a looping approach. It consists of two variables, ‘total’ and ‘total_odd’, which are both integer types, used for storing the result of the calculation (‘total’) and the sum of odd numbers (‘total_odd’) respectively. First, a for loop is initialized with variables ‘start’ and ‘end’ set to 1 and 100 respectively. While looping, ‘total’ is incremented and checked for odd numbers by applying a modulo matches function (%2==0). If it’s an odd number, ‘total_odd’ is incremented. After the loop terminates, the result of ‘total_odd’ is printed on the display. //Program total=0 total_odd=0 for (start=1;start<=100;start++) { total=total+start; if (start%2==1) total_odd=total_odd+start; } Print total_odd; The above algorithm helps to obtain the desired output with effective utilization of functions and list comprehension (Allison, 2015; Chen, 2021). This program subtracts odd numbers 1 through 100 and prints their result. References Allison, S. (2015). “Loops and Lists.” Software Carpentry: Teaching Principles of Programming and Computational Science. Cont…
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more