TRENDING NEWS

POPULAR NEWS

What Am I Doing Wrong In This C Program Need Help Asap

I need C programming help asap! (Problem #5)?

This semester is my first programming class (and probably last) and I am really struggling to complete this last project. I honestly have no idea how to even start on this.

The assignment is in C (not C++)and is actually due tonight, but I can turn it in for late credit, so something is better than nothing, but again, I don't even know where to start.

If someone could solve this and post it for me as an example I would be incredibly grateful. I promise that I'm not going to directly copy it, but having an example that I can learn from has always been my most efficient way to learn, so I that's how I would use it.

Here's the problem:

5. (15 pts) Write a recursive function called sum_primes() that accepts an unsigned integer, n, as an argument, and returns the sum of all primes from 2 to n. You must use recursion to solve this problem!


Please help, I'm desperate!

Thanks in advance!

-Spencer

Can someone help with a Programming (C#) question?

Write a method that accepts and displays two parameters: a string name of a movie and an integer running time in minutes. Provide a default value for the minutes so that if you call the method without an integer argument, minutes is set to 90. Write a console based program with a Main() method that proves you can call the movie method with only a string argument as well as with a string and an integer.

I have been trying to figure this out all afternoon. I can't get in touch with my teacher for help, so I am turning to the minds of YA! Only serious answers please, if you can't help then don't post.

Right triangle program in C?

Depending on how much information you want to give, you may need just an 'if', maybe an 'if-else', and possibly an 'else-if' as well.

Assuming you can do the "read input" part yourself, you'll need something like this for the rest of it:

unsigned a,b,c,a2,b2,c2;

/* read input .... */

/* compute squares */
a2 = a*a;
b2 = b*b;
c2 = c*c:

if (c2 == (a2 + b2)) {
puts("is right triangle, hypotenuse = c");
} else if (b2 == (a2 + c2)) {
puts("is right triangle, hypotenuse = b");
} else if (a2 == (b2 + c2)) {
puts("is right triangle, hypotenuse = a");
} else {
puts("not right triangle");
}

If you only wanted to check if a,b,c can be sides of a right triangle, you could do this:

printf("\n%u, %u, %u are ",a,b,c);
if (!((c2 == (a2 + b2)) ||
(b2 == (a2 + c2)) ||
(a2 == (b2 + c2)))) {
printf("not ");
}
printf("the sides of a right triangle\n");

Direct3D problems, help please?

So I want to play the Mortal Kombat Komplete Edition to PC, but I have encountered a problem.
When i try to start the game from a shortcut it says: "Missing file blabla, "binkw32.dll", but that is fixed if I try to open the game from the folder. But then another problem occurs.

When I open the game from the folder it says:"This game requires Direct3D 9.0c on Windows Vista and above."

I am using Windows 8 and I cannot download this version because it says: "Direct3D 9.0c is only compatible under windows vista" (something similar).

Is there anyway to fix this problem? Please help ASAP :D

JAVA HELP! Car Class. new InsuredCar?

WHAT AM I DOING WRONG?

Suppose you want to create a new InsuredCar class that is derived from the Car class. It adds one new boolean attribute, insured. Here is a constructor call for the class:

InsuredCar c = new InsuredCar("Ford", 15.0, 4.0, true);

Using super appropriately, write the constructor for the InsuredCar class. (Hint: model your solution after the constructor for the UsedCar class).

So far I have..

public class InsuredCar extends Car{

private boolean insured;
public InsuredCar(String whatMake, double cap, double amt, boolean ins){
super(whatMake,cap,amt);
insured = insured;
}
public boolean getInsured(){
return insured;
}
public void setInsured(boolean isInsured){
insured = isInsured;
}
}

BUT IT TELLS ME THIS ISN'T CORRECT. SOMEONE HELP!

Linked Lists Method Question (need help) [code provided]?

Hey guys, below is a piece of code. Underneath that is what I am trying to accomplish with my code, but am confused on what to do. Can someone please help?

public class PlayerLinkedList extends ShellLinkedList
{

public PlayerLinkedList( )
{
super( );
}

public void insert( Player p )
{
// insert as head
PlayerNode pn = new PlayerNode( new Player( p ) );
pn.setNext( head );
head = pn;
numberOfItems++;
}

public Player delete( int searchID )
throws DataStructureException
{
PlayerNode current = head;
PlayerNode previous = null;
while ( current != null
&& current.getPlayer( ).getID( ) != searchID )
{
previous = current;
current = current.getNext( );
}

if ( current == null ) // not found
throw new DataStructureException( searchID
+ " not found: cannot be deleted" );
else
{
if ( current == head )
head = head.getNext( ); // delete head
else
previous.setNext( current.getNext( ) );

numberOfItems--;
return current.getPlayer( );
}
}


public Player peek( int searchID )
throws DataStructureException
{
PlayerNode current = head;
while ( current != null
&& current.getPlayer( ).getID( ) != searchID )
{
current = current.getNext( );
}

if ( current == null ) // not found
throw new DataStructureException( searchID
+ " not found: cannot be deleted" );
else
{
return current.getPlayer( );
}
}
}

I want to include one more method that inserts a new player in the third position of the list. Head would be the first position. If the list is empty, the method will insert the new player as the head of the list.

Can anyone please help me with this? I would really appreciate it.

What are the pros and cons of axis bank ASAP account?

i want you to tell my story of ASAP account.to start with its not ASAP account. It took more than 15 days to get my account fully activated. lot of things done wrong, and bank branches dont care coz its a online account and they treat u like dog. And customer care always give fake or wrong info.whats wrong with ASAP account.No support or anything for this account, [ coz customer care is giving nonsense info just to pass u on to next agent, and they never update u on cases]Debit card fees, as the virtual card they provide as “free” is totally useless, coz no one accepts virtual debit card as a online payment method ( eg: google payments or paypal )Debit card will only be issued to your aadhar card address not your local address and they won't even take your address even if u give proof.Fake “ reward points” delighma, U wont get any points even if u its totally useless and a marketing gimmick.Non real time account sms. You wont get sms when money got debited or credited. its anytime in midnight or some other time0 interest till 10,000, even after 10,000 it ill be a fd in multiples of 500 inr and that’s not as straight as it seemsReally a total shitty bank,from standpoint of customer loyalty.But if you are looking for a zero bal account i highly recommend KOTAK 811 which is really awesome, and no bullshit as axis bank, its very good i opened in 3 min , agent came to my place to get biometric, my card came to my address in 2 days. rate of interest is for full amount. they don't have 24/7 customer care but they have AI and ML alogos which can take up all your needs without any agents, and only con would be they have very less branches and i personally hate going to bank. so win win.Good Luck

TRENDING NEWS