20.06.2022

Order of operations with integers

solve with steps:

-18 + (-24) divide by 6

. 0

Step-by-step answer

30.05.2023, solved by verified expert
Unlock the full answer

-7

Step-by-step explanation:

(-18+(-24))/6

= (-18-24)/6

= -42/6

= -7

Hope this helps

It is was helpful?

Faq

Mathematics
Step-by-step answer
P Answered by PhD

-7

Step-by-step explanation:

(-18+(-24))/6

= (-18-24)/6

= -42/6

= -7

Hope this helps

Mathematics
Step-by-step answer
P Answered by PhD

10

Step-by-step explanation:

6-(-12)/3

= 6-(-4)

= 6+4

= 10

Hope this helps!

Mathematics
Step-by-step answer
P Answered by PhD

10

Step-by-step explanation:

6-(-12)/3

= 6-(-4)

= 6+4

= 10

Hope this helps!

Mathematics
Step-by-step answer
P Answered by PhD
7

Step-by-step explanation:

Use PEMDAS:

PParentheses first

EExponents

MDMultiplication and Division

ASAddition and Subtraction

6:(-3)-(-9)           first - division

=-2+9          use commutative property a + b = b + a

=9+(-2)=9-2=7

Mathematics
Step-by-step answer
P Answered by PhD
7

Step-by-step explanation:

Use PEMDAS:

PParentheses first

EExponents

MDMultiplication and Division

ASAddition and Subtraction

6:(-3)-(-9)           first - division

=-2+9          use commutative property a + b = b + a

=9+(-2)=9-2=7

Computers and Technology
Step-by-step answer
P Answered by PhD

Following are the program to this question:

import java.util.*;//for user-input value  

public class Project01//Decalring a class Project01

{

public static void main(String asq[])//main method  

{

int ax1,ax2;//Decalring integer variables

Scanner oscr=new Scanner(System.in);//creating Scanner class Object

System.out.print("Enter the First number: ");//print message  

ax1=oscr.nextInt();//input first number

System.out.print("Enter the Second number: ");//print message

ax2=oscr.nextInt();//input second number

System.out.println(ax1+ "+"+ax2+"= "+(ax1+ax2));//use print method to perform the arithmetic operation  

System.out.println(ax1+"-"+ax2+"= "+(ax1-ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"*"+ax2+"= "+(ax1*ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"/"+ax2+"= "+(ax1/ax2));///use print method to perform the arithmetic operation

System.out.println(ax1+"%"+ax2+"= "+(ax1%ax2));//use print method to perform the arithmetic operation

System.out.println("The average of your two numbers is: "+(ax1+ax2)/2);//calculating average

}

}

Output:

Please find the attached file.

Explanation:

In the program, inside the class "Project01" and the main method two integer variable "ax1,ax2" is declared that uses the scanner class concept for input the value from the user-end, and in the next step, it uses the print method with the arithmetic operation to perform and prints its calculated value.


For this lab, you will write a Java program to prompt the user to enter two integers. Your program w
Computers and Technology
Step-by-step answer
P Answered by PhD

Written in Java

import java.util.*;

public class Project01{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int num1,num2;

 System.out.print("Enter first number: ");

 num1 = input.nextInt();

 System.out.print("Enter second number: ");

 num2 = input.nextInt();

 System.out.println(num1+" + "+num2+" = "+(num1 + num2));

 System.out.println(num1+" - "+num2+" = "+(num1 - num2));

 System.out.println(num1+" * "+num2+" = "+(num1 * num2));

 System.out.println(num1+" / "+num2+" = "+(num1 / num2));  

 System.out.print("The average of your two numbers is: "+(num1 + num2)/2);

}

}

Explanation:

import java.util.*;

public class Project01 {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

This line declares myfirstnum and mysecnum as integer

 int myfirstnum,mysecnum;

This line prompts user for first number

 System.out.print("Enter first number: ");

This line gets user input

myfirstnum= input.nextInt();

This line prompts user for second number

 System.out.print("Enter second number: ");

This line gets user input

 mysecnum = input.nextInt();

This line calculates and prints addition operation

 System.out.println(myfirstnum+" + "+mysecnum+" = "+(myfirstnum + mysecnum));

This line calculates and prints subtraction operation

 System.out.println(myfirstnum+" - "+mysecnum+" = "+(myfirstnum - mysecnum));

This line calculates and prints multiplication operation

 System.out.println(myfirstnum+" * "+mysecnum+" = "+(myfirstnum * mysecnum));

This line calculates and prints division operation

 System.out.println(myfirstnum+" / "+mysecnum+" = "+(myfirstnum / mysecnum));  

This line calculates and prints the average of the two numbers

 System.out.print("The average of your two numbers is: "+(myfirstnum + mysecnum)/2);

}

}

Computers and Technology
Step-by-step answer
P Answered by PhD

Following are the program to this question:

import java.util.*;//for user-input value  

public class Project01//Decalring a class Project01

{

public static void main(String asq[])//main method  

{

int ax1,ax2;//Decalring integer variables

Scanner oscr=new Scanner(System.in);//creating Scanner class Object

System.out.print("Enter the First number: ");//print message  

ax1=oscr.nextInt();//input first number

System.out.print("Enter the Second number: ");//print message

ax2=oscr.nextInt();//input second number

System.out.println(ax1+ "+"+ax2+"= "+(ax1+ax2));//use print method to perform the arithmetic operation  

System.out.println(ax1+"-"+ax2+"= "+(ax1-ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"*"+ax2+"= "+(ax1*ax2));//use print method to perform the arithmetic operation

System.out.println(ax1+"/"+ax2+"= "+(ax1/ax2));///use print method to perform the arithmetic operation

System.out.println(ax1+"%"+ax2+"= "+(ax1%ax2));//use print method to perform the arithmetic operation

System.out.println("The average of your two numbers is: "+(ax1+ax2)/2);//calculating average

}

}

Output:

Please find the attached file.

Explanation:

In the program, inside the class "Project01" and the main method two integer variable "ax1,ax2" is declared that uses the scanner class concept for input the value from the user-end, and in the next step, it uses the print method with the arithmetic operation to perform and prints its calculated value.


For this lab, you will write a Java program to prompt the user to enter two integers. Your program w
Computers and Technology
Step-by-step answer
P Answered by PhD

Written in Java

import java.util.*;

public class Project01{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int num1,num2;

 System.out.print("Enter first number: ");

 num1 = input.nextInt();

 System.out.print("Enter second number: ");

 num2 = input.nextInt();

 System.out.println(num1+" + "+num2+" = "+(num1 + num2));

 System.out.println(num1+" - "+num2+" = "+(num1 - num2));

 System.out.println(num1+" * "+num2+" = "+(num1 * num2));

 System.out.println(num1+" / "+num2+" = "+(num1 / num2));  

 System.out.print("The average of your two numbers is: "+(num1 + num2)/2);

}

}

Explanation:

import java.util.*;

public class Project01 {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

This line declares myfirstnum and mysecnum as integer

 int myfirstnum,mysecnum;

This line prompts user for first number

 System.out.print("Enter first number: ");

This line gets user input

myfirstnum= input.nextInt();

This line prompts user for second number

 System.out.print("Enter second number: ");

This line gets user input

 mysecnum = input.nextInt();

This line calculates and prints addition operation

 System.out.println(myfirstnum+" + "+mysecnum+" = "+(myfirstnum + mysecnum));

This line calculates and prints subtraction operation

 System.out.println(myfirstnum+" - "+mysecnum+" = "+(myfirstnum - mysecnum));

This line calculates and prints multiplication operation

 System.out.println(myfirstnum+" * "+mysecnum+" = "+(myfirstnum * mysecnum));

This line calculates and prints division operation

 System.out.println(myfirstnum+" / "+mysecnum+" = "+(myfirstnum / mysecnum));  

This line calculates and prints the average of the two numbers

 System.out.print("The average of your two numbers is: "+(myfirstnum + mysecnum)/2);

}

}

Computers and Technology
Step-by-step answer
P Answered by Master

Explanation:

#include <stdio.h>

#include <math.h>

#include <stdlib.h>

// Functions

////////////////////////////////////////////////////////////////////////////////

//

// Function : main

// Inputs : argc - the number of command line parameters

// argv - the parameters

// Outputs : 0 if successful test, -1 if failure

// Function : display

// arr : integer array to be printed

// Return Type : void, prints the contentes of array

// Function : swap_int

// Takes two unsigned short int pointers to values to be swapped

// Return Type : void, swaps the two values

// Function : reverseBits

// num : integer number whose bits are to be reversed

// Return Type : int, number with bits reversed

// Function : binaryString

// num : integer number whose binary representaion is needed

// Return Type : int, binary representation of num

void display_array(int arr[])

{

for (int i = 1; i < 11; i++)

{

printf("%d ", arr[i - 1]);

}

printf("\n");

}

void swap_int(unsigned short *a, unsigned short *b)

{

if (a == b)

return;

*a = *a + *b;

*b = *a - *b;

*a = *a - *b;

}

int reverseBits(int num)

{

int reverse_num = 0;

while(num != 0)

{

reverse_num <<= 1;

reverse_num |= num & 1;

num >>= 1;

}

return reverse_num;

}

void binaryString(int num)

{

if (num > 1)

binaryString(num >> 1);

printf("%d ", num & 1);

}

int main(int argc, char *argv[])

{

// Local variables

// NOTE: this is where you will want to add some new variables

int int_array1[10], int_array2[10];

unsigned short uint_array1[10];

int i;

//????

if (argc < 11)

{

printf("Exiting the program, missing input");

return 0;

}

// Step a - read in the integer numbers to process

for (i = 1; i < 11; i++)

{

int_array1[i - 1] = atoi(argv[i]);//converting input to integer

}

// Step b - Convert numbers into positive values by taking their

// absolute values and save them in int_array2.

for(int i = 1; i < 11; i++)

{

if(int_array1[i - 1] < 0)

int_array2[i - 1] = (-1) * int_array1[i - 1];

else

int_array2[i - 1] = int_array1[i - 1];

}

// Print all numbers in a single line using display_array function

// ????

display_array(int_array2);

// Step c - Convert these positive integers to numbers

// in the range 0,…,128 by implementing the mod operation

// save them back into int_array2.

// Print all numbers in a single line using display_array function

for(int i = 1; i < 11; i++)

{

int_array2[i - 1] = int_array2[i - 1] % 129;

}

display_array(int_array2);

// Step d - for each integer in int_array2 print:

// number, number of 1 bits, even or odd

for(int i = 1; i < 11; i++)

{

int num = int_array2[i - 1];

int count_1_bits = 0;

while(num != 0)

{

if(num % 2 == 1)

count_1_bits++;

num = num >> 1;

}

printf("number = %d, number of 1 bits = %d", int_array2[i - 1], count_1_bits);

if(int_array2[i - 1] % 2 == 0)

printf(" even\n");

else

printf(" odd\n");

}

// Step e - Cast each element of int_array2 to unsigned short

// and store them into uint_array1.

for(int i = 1; i < 11; i++)

{

uint_array1[i - 1] = (unsigned short) int_array2[i - 1];

}

// Step f - Reverse the order of array elements in uint_array1

// using swap_int function.

/*swap_ints(): function should swap the numbers without using

temp variable*/

for(i = 0; i < 10 / 2; i++)

{

swap_int(&uint_array1[i], &uint_array1[10 - i - 1]);

}

// Step g - Update each element of uint_array1 by using reverseBits function.

/* reverseBit(): The function should return the number (in

integer format) whose bits are reversed,

i.e., the top bit of the original number is

the bottom bit of the returned number, the

second from the top bit of the original

number is the second to the bottom bit of

the returned number. */

for(i = 1; i < 11; i++)

{

uint_array1[i - 1] = (unsigned short) reverseBits(uint_array1[i - 1]);

}

// Step h - Print each element of uint_array1 in a separate line along with

// binary representation of each of the numbers using binaryString function.

/* binaryString():This function should fill the text string

with a binary representation of the number

suitable for printing. You should be using

some bitwise operations to achieve this,

maybe shifting(<<) and and (&)

operation

*/

for(i = 1; i < 11; i++)

{

printf("number = %u and binary representation = ", uint_array1[i - 1]);

binaryString(uint_array1[i - 1]);

printf("\n");

}

// Return successfully

return(0);

}


Complete the commented parts in the code below: #include  #include  #include  // Functions  // // Fu
Complete the commented parts in the code below: #include  #include  #include  // Functions  // // Fu
Complete the commented parts in the code below: #include  #include  #include  // Functions  // // Fu

Try asking the Studen AI a question.

It will provide an instant answer!

FREE