What if i want two integers and return its value ??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What if i want two integers and return its value ???

int timesTwo(int x) { return x*2; }

29th Dec 2016, 6:57 AM
Aqib Asmat
Aqib Asmat - avatar
5 Answers
+ 2
See Piotr Ga's answer. that will allow you to take in two integers inside a function so you can x*8; y*8; Please like the answers that helped you. This is the way to say thank you :) It motivates us to provide help and lets us know that you have got ur problem solved. Thankyou :)
30th Dec 2016, 8:55 AM
Vishal++
Vishal++ - avatar
+ 1
you mean something like this?: int timestwo(int y, int x) { int result = x*y; return result; } ?
29th Dec 2016, 9:53 AM
Piotr Ga
Piotr Ga - avatar
0
What do you want the function to do? Return multiplication of two integers? Multiply both integers *2 separately? Note that you can only return one value
29th Dec 2016, 7:40 AM
Vishal++
Vishal++ - avatar
0
multiply both integers separatly by 8
30th Dec 2016, 8:50 AM
Aqib Asmat
Aqib Asmat - avatar
0
ty frnds for u ur responce
30th Dec 2016, 8:50 AM
Aqib Asmat
Aqib Asmat - avatar