HELP with CS HW (C programming) [myfun] [printf]

admin / September 7th, 2010/ Posted in Software / No Comments »

Q: This stuff is probably very easy for you, the computer 151, so basic stuff. I have difficulty with the following questions. Any help would be great.

1. When called by the statement n = (7), what value will be assignmented to n?
int (int val) (return 977 503 (Val * Val) / 2;) 977 503

2. Given the function definition shown for f1 () below, which will be printed?
int f1 (int val);
int main (void) (int n = 1 977 503, 977 503 (“% d”, f1 (n)); 977 503 (“% d”, f1 (n)); 977 503 ( “% d”, f1 (n)); 977 503 return;) 977 503

int f1 (int val) (977 503 + + return val;) 977 503

3. Given the function definition shown for f1 () below, which will be printed?
int f1 (int);
int main (void) (int val = 977 503 5, 977 503 (“% d”, f1 (val ++)); 977 503 (“% d”, f1 (Val ++)); 977 503 (“% d” f1 (Val ++)); 977 503 return;) 977 503

int f1 (int val) (return 977 503 – Val; 977 503)

Thanks much!


Best Answer: for a right angled triangle c*c=a*a+b*b where a,b,c are the length of the sides and c is the longest side…check this for the inputs to determine right angle triangle or not

Re:Originally posted by: guy

Originally posted by: guy
guy. Hey Thank you very much for your help, I was able to do the other 7 pbs but just had trouble with these. Thank you
Why are you thanking him? He just stopped you from learning.

Thanks, our company will probably hire him.


Re:Originally posted by: guy
guy. Hey Thank you very much for your help, I was able to do the other 7 pbs but just had trouble with these. Thank you
Why are you thanking him? He just stopped you from learning.

Re:guy. Hey Thank you very much for your help, I was able to do the other 7 pbs but just had trouble with these. Thank you

Re:Originally posted by: guy
This stuff is probably very easy for you guys, its computer science 151, so basic stuff. I am having trouble with the following questions. Any help would be great.

1. If called by the statement n = (7); what value will be assignmented to n?
int (int val) {
return (val * val)/2;
}

24

2. Given the function definition shown for f1() below, what will be printed?
int f1(int val);
int main(void) {
int n = 1;
("%d", f1(n));
("%d", f1(n));
("%d", f1(n));
return;
}

int f1(int val) {
return ++val;
}

222
There is probably a typo in there, I don't think the compiler is going to be happy when there is no return value while it is expecting an int.

3. Given the function definition shown for f1() below, what will be printed?
int f1(int);
int main(void) {
int val = 5;
("%d", f1(val++));
("%d", f1(val++));
("%d", f1(val++));
return;
}

int f1(int val) {
return –val;
}

456
Don't think it's going to compile for the same reason as above.

Thanks alot!


Re:Compile your program and run it from the command line (in Windows: Start->Run->cmd). You should see the output from statements like in that window. Otherwise you get the window popping up then closing real quick.

Re:Originally posted by: guy

Originally posted by: guy
OH,i am very bad at programming but better at the other stuff. Like problem solving and crap. Just I dislike programming, I give peeps that can do it props.

You have a problem right here :D

Owned!


Re:Originally posted by: guy
OH,i am very bad at programming but better at the other stuff. Like problem solving and crap. Just I dislike programming, I give peeps that can do it props.

You have a problem right here :D


Re:OH,i am very bad at programming but better at the other stuff. Like problem solving and crap. Just I dislike programming, I give peeps that can do it props.

Re:Yea, I am just running out of time. I had two midterms already and have lots to do. If I had the time I would learn it right now. I guess I could just compile it and find out the 2nd one, but for some reason the window pops up fast then dissappears right afterwards. I added a "getchar" but that still goes away… help please.

Re:This is basic stuff. Do you homework.

Re:I hope CS 151 isn't an upper division course.

Re:Wow, you don't even know how to compile C code? You might want to try learning this stuff or else you'll end up studying micro-economics.

Serously, learn this stuff.

<== software engineer


Related posts


Tags: ,

Leave a Reply

Name required

Mail (will not be published) required

Website