Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~3K People Reached
Favorite Tags

5 Posted Topics

Member Avatar for agons

[code] int maxRun(){ int longestRun=-1; int maxRoll=0; int numOfRolls[]=new int[6]; int roll; //import java.util.Random @ header int counter=0; while(counter<20){ Random gen=new Random(); roll=gen.nextInt(6)+1; numOfRolls[roll-1]++; counter++; } for(int i=0;i<6;i++){ if(numOfRolls[i]>maxRoll){ longestRun=i+1; maxRoll=numOfRolls[i]; } } return longestRun; } } [/code]

Member Avatar for polk230
0
2K
Member Avatar for guyfrompluto

I need to write a function that takes in an array of integers and an integer, checks if the sum of any of the numbers in the array is equal to the supplied integer. Any ideas would be much appreciated.

Member Avatar for Beat_Slayer
0
713
Member Avatar for ashu2401

Here is one in python hope it helps: [code=python] def sumOfNumbers(lst,num): temp=0 while temp<len(lst): for i in range(0,len(lst)): if i==temp: continue if lst[temp]+lst[i]==num: return True temp=temp+1 return False print sumOfNumbers([1,2,3,4,5,6],3) [/code]

Member Avatar for arkoenig
0
342
Member Avatar for guyfrompluto

Here is a starter program that prints prime factors of a supplied numbers as a string.It's quite buggy as the input 8 yields 1.2.4 when what i wanted is 1.2.2.2 and I don't understand why the return in line 32 (commented) is not executed. [code=java] //program to compute prime factors …

Member Avatar for guyfrompluto
0
347
Member Avatar for guyfrompluto

Simple program to check whether a number is prime or not. Something is seriously wrong because every result I get is 'false'. Help me out please. Thanks in advance. [CODE] class primeTesting { public static void main(String[] args){ int i=7; //changing the value everytime always gives false.... ??? boolean bool=false; …

Member Avatar for guyfrompluto
0
121

The End.