Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
Problem For School - Finding Average
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 10-06-2009, 09:37 PM
DeepSnow's Avatar
Active Member
 
Join Date: Jul 2009
Posts: 227
Default Problem For School - Finding Average

Hey, this should be simple for most of you;

Code:
#include <stdio.h>
int main()

{
int i;
for(i = 0; i<10; i++)
 {
  printf("%d\n", i);
 } 
return(0);
}
Now using a "for" loop or something similar to that one, write a program that prompts the user for how many numbers they wish to average, count up the numbers they typed in, and average them. I believe it will need to be functionless, but you have to declare some crap, I don't know. Printf and Scanf.

We are using something called C Sharp? But apparently it's pretty much C. We program in VI while connected to a Linux machine. I've been doing good up till shortly, when we had to make a simple calculator. I couldn't submit anything and am now 400/500 points, or a 80 percent. Even getting 100 on this next assignment will bring me to an 83, this is the one class I am not doing well in, and I will not fucking fail an elective.

Payment may be possible, as I said, I do not understand this shit and will most likely be coming back here for more assistance. [email protected] or nightmare3695 AIM, or just post back here. To be honest, I don't need help, yet just the entire completed code I can copy into notepad. If you have some weird issue with getting paid for writing a code, spill out how to start this. And I mean be basic, I understand basic, and that's it.

Thanks

*and jesus, be basic with writing the code too. It can't look too much like something I ripped off the internet. Because that stuff is available, but uses weird ass shit we don't know yet.
__________________

Last edited by DeepSnow : 10-06-2009 at 09:39 PM.
Reply With Quote
  #2  
Old 10-15-2009, 06:12 PM
Iloveroy
BANNED
 
Join Date: Nov 2008
Location: BC, Canada
Posts: 2,343
Default Re: Problem For School - Finding Average

Still need this?
I will write it for you when I get home, in school ATM.
Reply With Quote
  #3  
Old 10-15-2009, 10:35 PM
Swan's Avatar
When They Cry...
Ex-Moderator
 
Join Date: Jan 2007
Location: Japan
Posts: 4,404
Default Re: Problem For School - Finding Average

Quote:
Originally Posted by DeepSnow View Post
Hey, this should be simple for most of you;

Code:
#include <stdio.h>
int main()

{
int i;
for(i = 0; i<10; i++)
 {
  printf("%d\n", i);
 } 
return(0);
}
Now using a "for" loop or something similar to that one, write a program that prompts the user for how many numbers they wish to average, count up the numbers they typed in, and average them. I believe it will need to be functionless, but you have to declare some crap, I don't know. Printf and Scanf.

We are using something called C Sharp? But apparently it's pretty much C. We program in VI while connected to a Linux machine. I've been doing good up till shortly, when we had to make a simple calculator. I couldn't submit anything and am now 400/500 points, or a 80 percent. Even getting 100 on this next assignment will bring me to an 83, this is the one class I am not doing well in, and I will not fucking fail an elective.

Payment may be possible, as I said, I do not understand this shit and will most likely be coming back here for more assistance. [email protected] or nightmare3695 AIM, or just post back here. To be honest, I don't need help, yet just the entire completed code I can copy into notepad. If you have some weird issue with getting paid for writing a code, spill out how to start this. And I mean be basic, I understand basic, and that's it.

Thanks

*and jesus, be basic with writing the code too. It can't look too much like something I ripped off the internet. Because that stuff is available, but uses weird ass shit we don't know yet.
C# is vastly different to C. C# is more akin to Java than anything, and runs upon the .Net framework.

Have you ever actually tried to learn this stuff before? It's extremely basic stuff. Perhaps you haven't been paying attention in class. If so, you probably deserve to fail. You sound like you're making a demand rather than asking for help. The internet is not your army, so you could at least be polite.

Quote:
but you have to declare some crap, I don't know. Printf and Scanf.
You're going to need to say more than that or you'll seriously confuse people. Do you mean you need to include the stdio header to use printf() and scanf()?

I'm going to school soon, hence I won't have time to show you how to do this right now.
__________________
Quote:
[14:54:13] <&Filefragg> x9 is made of 5 glow in the dark gorilla dildos vibrating in unison.
[14:54:19] <%TDD> hot
[14:54:22] <+Aoi> Win
[14:54:23] <x9> I TOLD YOU NOT TO TELL ANYONE, DAMNIT
Reply With Quote
  #4  
Old 10-17-2009, 02:22 AM
d great one's Avatar
Apprentice
 
Join Date: Nov 2007
Posts: 930
Send a message via MSN to d great one Send a message via Yahoo to d great one
Default Re: Problem For School - Finding Average

If you are using a C#, you can do it in the console.

And write it Console.Write("Enter how many average you want to compute: ");

Then follows the loop.
I can do this, but you aren't nice to begin with asking for help.
Maybe a little nicer would make people help you.
__________________
SCAMMERS ARE LOSERS. DO NOT BE ONE OF THEM
==========================
New: Buying all account upgrades + 4 vouches
==========================
I CAN MM FOR YOU - MM THREAD + MM VOUCHES || vouch(es) on this thread: 10
==========================
MY MSN: [email protected]
==========================
NOW SELLING RSGP || vouch(es) on this thread: 30
==========================
Account Shop || vouch(es) on this thread: 1
Lost thread: My buying + vouches thread || vouch(es) on this thread: 82
Reply With Quote
  #5  
Old 10-17-2009, 04:10 AM
Newcomer
 
Join Date: Oct 2009
Posts: 7
Default Re: Problem For School - Finding Average

Code:
using System;

namespace Application1
{
    class Program
    {
        static void Main(string[] args)
        {
            double i = 0;
            double sum = 0;

            for (i = 0; i < 10; i++)
            {
                sum = sum + i;
            }

            Console.WriteLine(sum / i);
        }
    }
}
Can't get much more basic looking than that. Suggest reading through some beginners guides to understand the C# code before you turn it in.

Last edited by WCCobra : 10-17-2009 at 04:11 AM. Reason: typo
Reply With Quote
  #6  
Old 10-17-2009, 11:42 PM
Member
 
Join Date: Dec 2008
Posts: 91
Default Re: Problem For School - Finding Average

80% is BAD? Are you retarded? You deserve to fail... but I am feeling generous.
Code:
#include <stdio.h>

main() {
    int num_count;
    printf("input # of numbers to average: ");
    scanf("%d", &num_count);

    int i;
    int sum = 0;
    for (i = 0; i < num_count; ++i) {
        int input;
        scanf("%d", &input);
        sum += input;
    }

    printf("average: %d\n", sum / num_count);
    return 0;
}
note the average is calculated using integer arithmetic, and not floating point; it is not all too accurate. it prompts for the number of numbers to average, and then you input the numbers and hit enter after each:
Code:
input # of numbers to average: 2
1
3
average: 2
Reply With Quote
  #7  
Old 12-01-2009, 11:35 AM
Active Member
 
Join Date: Nov 2005
Posts: 158
Default Re: Problem For School - Finding Average

So do you want it coded in C# or C?
Reply With Quote
  #8  
Old 01-11-2010, 04:31 PM
KB2486's Avatar
Active Member
 
Join Date: Aug 2009
Location: Sythe!
Posts: 172
Default Re: Problem For School - Finding Average

Quote:
#include <stdio.h>

main() {
int num_count;
printf("input # of numbers to average: ");
scanf("%d", &num_count);

int i;
int sum = 0;
for (i = 0; i < num_count; ++i) {
int input;
scanf("%d", &input);
sum += input;
}

printf("average: %d\n", sum / num_count);
return 0;
}
You dont need to declare int input inside loop, just put outside loop. Scanf function will override the lastest value every loop count.
__________________
Click here to see my Vouches!

Last edited by KB2486 : 01-11-2010 at 04:35 PM.
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 06:06 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1