C# Homework - Need Help

Page 1 of 1

5 Replies - 205 Views - Last Post: 01 July 2012 - 06:27 AM Rate Topic: -----

#1 6logos  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-June 12

C# Homework - Need Help

Posted 30 June 2012 - 07:11 PM

Hi guys!

I am currently taking up C# programming on our school..
Our instructor gave us a homework to work with..

The problem are:

1.) To get the exponential product of the two input integer values using any loops (for loop, while or do while).

Ex:

Input integer value: 2
Input Exponent: 3
Output >>> 8

2.) To get the square root of the input value using any loops (for loop, while or do while)..

Ex:

Input Value: 25
Square root : 5


I need it ASAP..
Thank you guys!

Is This A Good Question/Topic? 0
  • +

Replies To: C# Homework - Need Help

#2 Momerath  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 809
  • View blog
  • Posts: 1,947
  • Joined: 04-October 09

Re: C# Homework - Need Help

Posted 30 June 2012 - 09:04 PM

This is not a homework writing service. How about you put some effort in.
Was This Post Helpful? 0
  • +
  • -

#3 6logos  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 30-June 12

Re: C# Homework - Need Help

Posted 01 July 2012 - 12:03 AM

View PostMomerath, on 30 June 2012 - 09:04 PM, said:

This is not a homework writing service. How about you put some effort in.


I know but the algorithm will do.. Just dont know how to get the square root using a for loop.. Ive finished up the exponential earlier today..
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1690
  • View blog
  • Posts: 2,553
  • Joined: 21-June 11

Re: C# Homework - Need Help

Posted 01 July 2012 - 02:31 AM

This wiki article describes various ways to calculate the square root of a number.

If you know that you will only get numbers whose square root is an integer, it becomes much simpler (though, unless you left something out, the assignment did not say that). For example you could also just brute-force it (i.e. try every number between 1 and n to see whether that number's square is equal to n) - assuming efficiency is not a concern.
Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5667
  • View blog
  • Posts: 22,511
  • Joined: 23-August 08

Re: C# Homework - Need Help

Posted 01 July 2012 - 03:44 AM

View Post6logos, on 01 July 2012 - 03:03 AM, said:

View PostMomerath, on 30 June 2012 - 09:04 PM, said:

This is not a homework writing service. How about you put some effort in.


I know but the algorithm will do.. Just dont know how to get the square root using a for loop.. Ive finished up the exponential earlier today..


This just in: software development is more than just writing code, it's also coming up with algorithms to accomplish the task at hand. This assignment is just as much about that process as writing actual code.
Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is online

  • Closing in on 5,000
  • member icon

Reputation: 4927
  • View blog
  • Posts: 10,464
  • Joined: 02-June 10

Re: C# Homework - Need Help

Posted 01 July 2012 - 06:27 AM

Quote

I don't know what to type. What do I put in the code to make it do x,yz


That's not going to fly around here. You have to at least try. We don't expect it to be right all the time. If it were right you wouldn't have a question. If you have no code, there is nothing for us to help you with. You really do have to look in your textbook at the examples. Follow the examples. Look at the syntax and copy it into your program. Then adjust as needed to fit the assignment. If you make an effort, we will too.

90% or more of the problems we see here are because rookies don't stop and plan nor block out their code into logical segments.
This article should help you see a way to block out your code by stubbing out the methods and logic, then filling in each method as you research it:
This is the 'Help me with my homework' article you wanted.

I don't want you to write my code, just give me ideas on how to solve my problem. - Read this article
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1