How to get min/Max value of a all column in a two-dimensional arra so for example, lets say you have the following 2d array: 1 2 3 4 5 6 7 8 9 Than the out put should be: -- col 1 -- min value at col 1 is 1 max value at col 1 is 7 -- col 2 -- min value at col 2 is 2 max value at col 2 is 8 -- col 3 -- min value at col 3 is 3 max value at col 3 is 9 public static void col(int[][] array) { for …

Member Avatar
Member Avatar
+0 forum 1

Again, calculate the minimum number of bills or coins required for a given amount of money (change). This time we will use a Go map instead of a csv string converted to a structure.

Member Avatar
+0 forum 0

This Go snippet calculates the minimum number of bills or coins needed for a given amount of money (change) requested. The program also gives the denomination and number. US curency is used in this example, but can be changed to another currency.

Member Avatar
+1 forum 0

**hello peeps and geeks, i am missing the MinSpanningTree function here.. any help please? need to fill up the function to get a) Minimum spanning tree cost for the graph b)Spanning tree path for the graph. E.g in matrix or adjancency list. ** #include <iostream> #include <ctime> // For time() #include <cstdlib> // For srand() and rand() #define N 6 #define infinity 9999999 using namespace std; void MinSpanningTree(int AdjMat[N][N]) { cout<<" The minimal Spanning Tree cost is "; cout<<"The minimal Spanning path is "; // A B C D } int main () { int AdjMat[N][N] = { 0, 1, …

Member Avatar
Member Avatar
+0 forum 2

Hello all. I wrote a program that gives me 100 random values from the range between -100 to +100. How am I supposed to find the minimum, maximum, and average of the values that will be listed when I run the program? I appreciate the help anyone can give me. Also, this is for a class and we are not allowed to use Arrays. Thanks again. Here is what I have so far: float random_integer; float lowest=-100.00, highest=100.00; float range=(highest-lowest)+1; for(float index=0; index<100; index++) { random_integer = lowest+float(range*rand()/(RAND_MAX + 1.0)); cout << random_integer << endl; } float sum; float average; …

Member Avatar
Member Avatar
+0 forum 7

this code gives the correct result upto size 6 (i'v run this a few times, and 6 seems to be the boundary), although the intermediate steps are all insane! then onwards, from size 7, it returns minimum value 0 /*minimum of an array using recursion*/ #include<stdio.h> #include<stdlib.h> int findMin(int* arr,int min,int size); int* populateArray(int size); void printArray(int* arr,int size); int main(){ int i=0,size=0,min=0; int* arr; printf("enter size of array: "); scanf("%d",&size); arr=populateArray(size); printf("array is: "); printArray(arr,size); min=*(arr+0); min=findMin(arr,min,size); printf("\n\nthe min value in the arr is: %d\n",min); return 0; } int* populateArray(int size){ int i=0; int* arr; arr=(int*)malloc(sizeof(int)*size); srand(time(NULL)); for(i=0;i<size;i++){ *(arr+i)=(rand()%1000); …

Member Avatar
Member Avatar
+0 forum 5

I tried to use a different forum but I was completely out of my league with the responses. I am extrememly new to python. As a project, I'm supposed to ask the user to input a file name, check that the file exists, output the numbers in the file, and sort them for biggest to smallest. The trick is, I can't use built in functions to do the sorting. I have to use this algorithm: for each i from range(n) for each j from range(n-i) if A[j-1]<A[j] swap(A[j], A[j-1]) Here's what I've been playing with: def main(): try: file=open(input("Please enter …

Member Avatar
Member Avatar
+0 forum 4

I am trying to get at least 5 minimum values from an array of integer my code attached works but it skips few values public static void main(String[] args) { int array[] = {0, 1, 2, 1, 4, 5, 1, 7, 8, 1, 10, 11, 12, 13, 1, 15, 16, 17, 18, 19, 20, 2, 22, 23}; int min = 0; int index = 0; String output = ""; for (int x = 0; x < 5; x++){ min = array[x]; index++; for(int i = index, limit = array.length; i < limit; ++i){ if(array[i] <= min){ min = array[i]; index …

Member Avatar
Member Avatar
+1 forum 7

The code below compares three numbers and it prints out the Maximum and Minimum value, let me hope it will rescue somebody :) import java.util.Scanner; public class MaxMin { public static void main(String args[]) { int w,x, y; System.out.println("\n\nTHE PROGRAM BELOW CALCULATES AND OUT PUTS THE MAXIMUM AND MINIMUM OF THREE DIFFERENT MARKS OBTAINED"); System.out.println("\n\nTHE PROGRAM HAS BEEN PRODUCED FOR THE JAVA ASSIGNMENT GIVEN BY MR GOLOOBA RONALD"); System.out.println("\n***********************************************************************"); System.out.println("\n Enter Your first value: "); Scanner in = new Scanner(System.in); w = in.nextInt(); System.out.println("\nEnter Your second value: "); x = in.nextInt(); System.out.println("\nEnter Your third value: "); y = in.nextInt(); if …

Member Avatar
Member Avatar
+0 forum 2

I'm trying to write a program that will ask the user to input the number of values he wants, prompt him for the values and then print out the maximum value and the minimum value. This is what I have so far: count=1 echo "Enter number of integers" read n while [ $count -le $n ] do echo "Enter integer" read x current=$x if [ $current -gt $x ]; then max=$current fi if [ $current -lt $x ]; then min=$current fi done echo "Max value is $max" echo "Min value is $min"

Member Avatar
Member Avatar
+0 forum 2

Hi guys... I need some help from you all.. **Actual Scenario is :** This is Module to Update today's price of products and these TextBoxes below is created in loop with <input type="text" id="<?="rate2".$i?>" name="<?="rate2".$i?>" size="5" /> ($i is increment variable of loop) also I already got abc rate (Standard price). **Now Problem is :** Whenever user enters the value on 1 TBX it should compare this.value with abc rate and if this.value is low then entire row's text color should be red, so on. then finally, it should also highlight the lowest of all. **Please help me in this …

Member Avatar
Member Avatar
+0 forum 3

The End.