Post

Replies

Boosts

Views

Activity

Reply to How can i make the calculator have multiple numbers stored, while calculating?
I made a calculator that does multiple things (adding consecutive numbers, adding multiple numbers, etc) but I am having trouble making it so that the calculator can multiply multiple numbers. So far, I've basically copied the code that adds minus the vat multiple numbers, but I can't figure out how to make it multiply instead of add. Here is my code: import java.util.Scanner; public class SumOfNumbers { public static void main(String arg[]) { int n; int sum = 0; https://vatonlinecalculator.co.uk/ Scanner s = new Scanner(System.in); System.out.print("Please enter how many numbers you want to add up to: "); n = s.nextInt(); System.out.println("you entered: " + n + ""); sum = addConsecutiveNumbers(n); System.out.println("sum of 1 to "+n+" = "+sum); //following code is sum of any numbers you entered from console //store the numbers into an array int num; int sumOfNums=0; System.out.print("Please enter how many numbers you want to sum: "); num=s.nextInt(); System.out.println("you want to sum "+num+" numbers "); sumOfNums = addNumbers(num); System.out.println("sum of "+num+" numbers = "+sumOfNums); } //Define a method which add consecutive numbers based on user's input and return the sum of the numbers private static int addConsecutiveNumbers (int number) { int sum = 0; for (int i = 1; i <= number; i++) { sum = sum + i; } return sum; } //Define a method which add numbers based on user's input and return the sum of the numbers private static int addNumbers (int num) { Scanner s = new Scanner(System.in); int a[] = new int[num]; int sumOfNums = 0; for(int k = 0; k < num; k++) { System.out.println("enter number "+(k+1)+":"); a[k] = s.nextInt(); System.out.println("The array of a[" + k + "] = " + a[k]); } for(int j = 1;j < num ; j++) { sumOfNums += a[j]; } return sumOfNums; } //below is the part of code that I am having trouble with. public static int multiplyNumbers(int num) { int Area = 0; Scanner s = new Scanner(System.in); int a[] = new int[num]; System.out.println("Please enter how many numbers you want to multiply:"); num=s.nextInt(); for(int l = 0; l < num; l++) { System.out.println("enter number "+(l+1)+":"); a[l] = s.nextInt(); System.out.println("The array of a[" + l + "] = " + a[l]); } return Area; } }
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’22
Reply to Apple Sign In - No code on redirect
Clear your browser cache to get the latest. Server cache – Your site is being cached with some caching software, and this needs to be updated to include your redirect. Not matched – Your redirect is not matching the URL . If you are using a regular expression then check your expression. I use this URL for redirect purpose. I suggest it for anyone.
Topic: App & System Services SubTopic: General Tags:
Nov ’22
Reply to Missing redirection to a valid redirect URI
While working on a web based client, you have to ensure that the redirect URI passed while authentication, is the same as the one given during registration. If the redirect uri is not the one given during registration, an invalid redirect uri error will be thrown. A redirect URI, or reply URL, is the location where the authorization server sends the user once the app has been successfully authorized and granted an authorization code or access token.
Topic: App & System Services SubTopic: General Tags:
Nov ’22
Reply to Xcode: Show random word every day in my app!?
Launch Xcode then click “Create a new random word combiner Xcode project” in the Welcome to Xcode window or choose File > New > Project. In the sheet that appears, select the target operating system or platform and a template under Application. In the following sheets, fill out the forms and choose options to configure your project. import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Declare String value let firstName:String = "Sergey" // Declare Int value let intNumber:Int=5 // Call the "takeAway(https://seotoolsystem.com/word-combiner)" function we have extended the Int class with: print("5 take away 4 equals \(intNumber.takeAway(4))") // Call the greatTheWorld() function we have extended the String class with firstName.greatTheWorld() } } // Extend the String class in Swift extension String { func greatTheWorld() { print("Hello world") } } // Extend the Int class in Swift extension Int { func takeAway(a:Int)->Int { return self-a; } }
Nov ’22