Call me a n00b, but I need some C help.

Danman

Lifer
Nov 9, 1999
13,134
0
0
#include <stdio.h>

void main()
{
int number;
scanf("%d",&number);
printf("%d",number);
return(0);
}

That's teh code. Here's what it asks:

Write a complete program that

declares an integer variable,
reads a value from the keyboard into that variable, and
writes to standard output the square of the variable's value.
Besides the number, nothing else should be written to standard output.

And I just trying to delcare it after it scans it in, it said not standard output. POS. :|
 

Danman

Lifer
Nov 9, 1999
13,134
0
0
Originally posted by: geno
n00b

Thanks. :D

Figured it out finally.

#include <stdio.h>

void main()
{
int number;
scanf("%d",&number);
printf("%d",number*number);
return(0);
}



OKAY THIS THREAD IS OVAR.
 

geno

Lifer
Dec 26, 1999
25,074
4
0
Originally posted by: cashman
Originally posted by: geno
n00b

Thanks. :D

Figured it out finally.

#include <stdio.h>

void main()
{
int number;
scanf("%d",&number);
printf("%d",number*number);
return(0);
}



OKAY THIS THREAD IS OVAR.


good job man. C is tough tough stuff to get used to, but once you get the hang of it, you'll be happy you learned it :)
 

KingNothing

Diamond Member
Apr 6, 2002
7,141
1
0
#include <stdio.h>

int main()
{
int number;
scanf("%d",&number);
number = number * number;
printf("%d",number);
return 0;
}

n00b
 

Danman

Lifer
Nov 9, 1999
13,134
0
0
Originally posted by: KingNothing
#include <stdio.h>

int main()
{
int number;
scanf("%d",&number);
number = number * number;
printf("%d",number);
return 0;
}

n00b

Ohhhhhh........but it doesn't work!

COUNTER N00BED! :D
 

KingNothing

Diamond Member
Apr 6, 2002
7,141
1
0
Originally posted by: cashman
Originally posted by: KingNothing
#include <stdio.h>

int main()
{
int number;
scanf("%d",&number);
number = number * number;
printf("%d",number);
return 0;
}

n00b

Ohhhhhh........but it doesn't work!

COUNTER N00BED! :D

I compiled and ran that program and then copied the code into here, I am quite sure it works. REJECTED!