Answer:
// This program is written in C++ programming language
// Comments are used for explanatory purpose
// Program starts here
#include <iostream>
#include <string>
using namespace std;
// Declare variables
int inputvar;
// Declare output variable as array
int outputvar[32];
// Set a counter for binary array
int i = 0;
while (inputvar > 0) {
// Divide inputvar by 2 and store remainder in outputvar
outputvar[i] = n % 2;
inputvar/=2;
i++; // increment i by 1
}
// End of division
// Prin resulting array in reverse order
for (int j = i - 1; j >= 0; j--) {
cout << outputvar[j];
}
return 0;
}
// End of Program
Answer:
import java.util.Scanner;
public class num4 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int sumOdds =0;
int sumEvens =0;
int num;
do{
System.out.println("Enter positive integers");
num = in.nextInt();
if(num%2==0){
sumEvens+=num;
}
else if (num%2!=0){
sumOdds+=num;
}
}while (num>0);
System.out.println("The sum of evens: "+sumEvens);
System.out.println("The sum of odds: "+sumOdds);
}
}
Explanation:
- Import Scanner class to prompt and receive user input
- Declare the following variables and initialize them int sumOdds =0, int sumEvens =0, int num;
- Create a do....while loop That continously prompts user to enter a positive number. The loop should terminate when a negative number is enters (n<=0)
- Within the while loop use an if condition with the modulo (%) operator to determine even and odd numbers and add to the respective variables
- Outside of the while loop Print sum of odds and sum of evens
Answer:
<em>C</em>
Explanation:
technology deals with the use of computers in school and work
Answer:
The answer to the given question is the option "a".
Explanation:
A function is a block of organized code that provides the reusability of the code. It is used to perform a separate, complex action. In programming languages name is different like, functions, methods, subroutines, procedures, etc. but the working of the function is the same. The purpose of the function that does not return a value is the option
"a" and All the options are correct.
Answer:
this is no image for me to see to to do
Explanation: