answersLogoWhite

0

CLS
FOR n = 2 TO 100
FOR k = 2 TO n / 2
flag = 0
r = n MOD k
IF r = 0 THEN
flag = 1
EXIT FOR
END IF
NEXT k
IF flag = 0 THEN PRINT n,
NEXT n
END

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

Make a C programming that displays the first four perfect numbers?

create a program that iterates until it finds a perfect number, then store that perfect number into an array. Continue iterating until you find three more. Then, you have an array of four perfect numbers.


Write a C program that takes a binary file as input and finds error check using different mechanisms?

write a c program that takes a binary file as input and finds error check using different mechanisms.


What is the pseudo code for a program that finds the product of two numbers?

int x; //first number int y; //second number int z = x*y;


What is the linux program that finds and repair disk error?

fsck


How do you create Write a program that takes 10 integers as input The program will place these integers into an array and display the following 1. List in ascending order 2. mean 3. median 4.max val?

import java.util.Arrays; import java.util.Scanner; public class Answers { public static void main(String[] args) { //Creates a scanner object named console. Scanner console = new Scanner(System.in); //Variabels int [] numbers = new int [10]; double avg = 0.0; double median = 0.0; int max = numbers[0]; double count = 0.0; //User input. for (int i = 0; i < numbers.length; i++){ System.out.print("Number: "); numbers[i] = console.nextInt(); } //break System.out.println("==============="); //finds the average and max value. for (int i = 0; i < numbers.length; i++){ count += numbers[i]; avg = count / numbers.length; //average if (numbers[i] > max){ //finds the max value. max = numbers[i]; } } median = (numbers[4] + numbers[5])/2; //Median value //Display to user. System.out.println("Highest value found: " + max); //Show maximum value found in array System.out.printf("Median is: %.3f \n",median); //Show median System.out.printf("Average is: %.3f \n",avg); //Show average sortAsc(numbers); //Print out whole array ascending } //Method for sorting an Array ascending. public static void sortAsc(int [] array){ for (int i = 0; i < array.length; i++){ Arrays.sort(array); System.out.println(array[i]); } } } This should do everything you asked for, hope this helps!

Related Questions

Make a C programming that displays the first four perfect numbers?

create a program that iterates until it finds a perfect number, then store that perfect number into an array. Continue iterating until you find three more. Then, you have an array of four perfect numbers.


Write a C program that takes a binary file as input and finds error check using different mechanisms?

write a c program that takes a binary file as input and finds error check using different mechanisms.


How do you compile and execute a java program which finds out the highest of any five numbers?

it will be destroyed.


Write a program that takes a binary file as input and finds error check using different mechanism?

networking


What is the pseudo code for a program that finds the product of two numbers?

int x; //first number int y; //second number int z = x*y;


Which command line tool finds and displays objects in active directory that meet specified criteria?

DSQUERY


HOW TO SOLVE 'C' problem?

1. write a 'c' program to read 4(four)numbers from a file 'BANK' and calculate the average of the numbers.Now print the calculated average in another output file 'AVERAGE' 2. write a 'c' program that finds the sum and average of inputted five integer numbers of the array using dynamic memory allocation function malloc(). 3. write a 'c' program to create simple elements 1,2,3,4 in the link list of 4(four)nodes and display the list's elements. 4. write a 'c' program to convert the expression (A+B)/(C+D) into postfix expression into stack.and then evaluate it for A=10,B=20,C=15,D=5 and display the stack status after each operation. 5. write a 'c' programto create a linked list implemented on an array containing the following numbers:1,2,3,3,3,4,4,9 and pack it to remove the duplicate numbers.so that only the following data are contained by the nodes:1,2,3,4,9


What is the linux program that finds and repair disk error?

fsck


Is there a program that finds a selected color and clicks on it?

Impossible sorry. :(


What object finds and displays selected data?

Say you want to display A1. You would put into the cell =A1.


What object finds and displays selected data in Microsoft access?

Say you want to display A1. You would put into the cell =A1.


What are the release dates for The Jack Benny Program - 1950 Jack Finds a Double 15-23?

The Jack Benny Program - 1950 Jack Finds a Double 15-23 was released on: USA: 12 March 1965