Question

6. Consider the following program: #include <stdio.h> main() { int a,b,c,d ; a=0; while (1) { printf(%d\n, a); printf(Inpu

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#source code:

#include <stdio.h>

int fun(int a,int c){ //function definition

return a+c;

}

int main(){

int a,b,c,d; //here decalre the variables

a=0; //here initialize the variable a with 0

while(1){

printf("%d\n",a); //here print the a value

printf("Input? ");

scanf("%d",&c);

if(c==0){

break;

}

d=0;

for(b=1;b<=c;b++){ //for loop used for the iteration

if(c%b==0){ //in for loop we have if

d++;

}

}

if(d==2 || c==1){ //if condition here

a=fun(a,c); //invoke the function

}

}

return 0;

}

1 #include <stdio.h> int fun(int a, int c){ //function definition return a+c; 2 3 4 5 } 7 8 int main() { int a,b,c,d; //here

#output:

user user-Latitude - 3490:-/Desktops gcc 1.0 -0 samp user@user-Latitude - 3490:-/Desktop$ ./samp 10 Input? 4 0 Input? 9 10 In

#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks..

Add a comment
Know the answer?
Add Answer to:
6. Consider the following program: #include <stdio.h> main() { int a,b,c,d ; a=0; while (1) {...
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