[Solved] Sum of two array [closed]

NSArray *firstArray=[NSArray arrayWithObjects:@”1″,@”2″,@”3″, nil]; NSArray *secondArray=[NSArray arrayWithObjects:@”10″,@”20″,@”30″, nil]; NSMutableArray *sumArray=[NSMutableArray new]; for (NSInteger i=0; i<[firstArray count]; i++) { NSString *newValue=[NSString stringWithFormat:@”%ld”,([[firstArray objectAtIndex:i]integerValue] + [[secondArray objectAtIndex:i]integerValue])]; [sumArray addObject:newValue]; } NSLog(@”sum=%@”,sumArray); Output is : sum=( 11, 22, 33 ) NOTE: both firstArray & secondArray must be of same size, and contain integers as string. Otherwise you need … Read more

[Solved] how to take (6+5) as a single input from user in python and display the result [closed]

Here is a simple calculator example to help get you started. while True: num1 = input(‘First Number: ‘) num2 = input(‘Second Number: ‘) op = input(‘Operator: ‘) try: num1 = int(num1) num2 = int(num2) except: print(‘Input a valid number!’) continue if op not in [‘+’, ‘-‘, ‘*’]: print(‘Invalid operator!’) continue if op == ‘+’: print(str(num1 … Read more

[Solved] Add the factors of a number

import java.util.Scanner; public class Demo { public static void main(String[] args) { Scanner x=new Scanner(System.in); int n=0;int g=0; int term=0;int temp=0; int sum=0; int factor=1; System.out.print(“Input N:”); n=x.nextInt(); g=n; int number = 0; if (n<=0) { System.out.println(“Please enter a positive integer”); System.exit(0); } if (n>0) { System.out.print(“The factors are:”); while (factor<n) { if (n%factor==0) { … Read more

[Solved] I’m noob here. Need a little help to add values on EditText

Try using setOnClickListener to listen to click events import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; public class MainActivity extends AppCompatActivity { EditText abasic, ahra, aca, lopfd, lophd, la; TextView ebasic, ehra, eca, agross, egross, loprs, hdrs, lars, td, spd, eepf, erpf, tpf, eeesi, eresi, tesi, pfesi; … Read more