Question

#include<stdio.h> int functionl (int x, int y); int main() int ij=2,k; for(i=1;i<=5; i++) k = function1(ij); printf(k=%d\n,
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#include<stdio.h>
int function1(int x,int y); //function declaration
int main()
{
int i,j=2,k;   
for(i=1;i<=5;i++) //iterates the loop for 5 times   
{
k=function1(i,j); //function call with paramaters i,j
printf("k=%d\n",k); //printing the value returned by the function function1()
}
return 0;
}

int function1(int x,int y) //function definition
{
int z;
z=x*2+y; //multiplies x value with 2 and adds y value and assigns result to the 'z'
return z; //returns z to the main()
}

CODE SCREENSHOT:

#include<stdio.h> int function1(int x, int y); int main() //function declaration int i, j=2,k; for(i=1;i<=5; i++) //iterates

CODE OUTPUT:

k=4
k=6
k=8
k=10
k=12

SCREENSHOT:
k=4 k=6 k=8 k=10 k=12

Add a comment
Know the answer?
Add Answer to:
#include<stdio.h> int functionl (int x, int y); int main() int ij=2,k; for(i=1;i<=5; i++) k = function1(ij);...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT