0 like 0 dislike
458 views

Please look through the code given below; there might be something wrong. You are asked to state what parts are missing or wrong, explain how to fix the code. Then tell us what the output will be

** This is an essay question **

Code

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]) {
	int a, i;
	printf("Enter a number: ");
	scanf
	
	if(a=0){
		printf("Please do not enter a negative number or zero")
	}
	
	else
	
	for(i=1;i<=a;i+){
		if(i%2!=0){
		printf("\n %d--Odd", i);
		
		printf("\n %c--Even", i);
	}
	
	return 0;
}

 

****    % = reminder of division

[Exercise] Essay (Open question) - asked in Chapter 3: Branching, Looping and Functions by (5.9k points)
ID: 30244 - Available when: Unlimited - Due to: Unlimited
| 458 views
0 0
What do you mean by reminder of division? do we have to divide by 2?
0 0
Hi.

It's just an explanation of an operation called 'Moderator'. By using it, it keeps a remainder number. Such as
2%4 = 2        remainder = 0
2%5 =  2        remainder = 1

14 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main(int argc, char *argv[]) {
* * * * * *** ** *** *** * a, i;
******* * * * **** *** ** * ** * a number: ");
** *** **** ** **** *** * ** * &a);
* * ** * ** ** **
** * ** ** * *** * ** *
* ** * * ** ** ** ** ** * ** * * * *** *** * * * * * do not enter a negative number or zero");
* *** ** * ***** ** * ***
** ** ******* * *
* * * ** * * * * * ** ** * *****
*** * * ** ** ** * ** * *** ** *** * *
** * * *** ** * * ** * * * ** * * * * * *
* ***** *** * * *** * * ** ***** ** * * * * ** ** **** %d--Odd", i);
* *** * * ** * ** * * * * * * * * *** * ** *
* * * *** * ******* **** ***
*** *** * * ** ** * ***** * * * * **** ** ** * **** *** %d--Even", i);
**** *** ***** * ** * ** * * *** ****
** *** **** * ** ** ****
* * ** ** ** * *** * *** 0;

}
50/100 answered by (290 points)
reshown by
0 like 0 dislike
Hidden content!
* * * * * ** **
* * * ** * * ***



int main(int argc, char *argv[]) {
* * int a, i;
** ** * *** * *** *** a number: * ***
* *** ** * * ** ** ** * * * *** * **
**** ** **

**** * * * ** ** *
* ***** *** ** *** * ** * ** ** * do not enter a negative number or **** * *
***** **** ** }
* * * ***

* *** * * * else
*** ** ** * ***** **
** ***** * * ** * * *
** * ** **** * * ** * ** *** ** * i);
*** ** * * * ** }
* *** * * * * ** *** else{
** * * * * ** **** * * ** ** * * *** * i);
** *** * * * ** * * }
* * * * }
* ** * * ** return 0;

}
50/100 answered by (271 points)
0 like 0 dislike
Hidden content!
* ** * * ** * ***


* ** ******* ** *



/* run this * * the ** ** *** * or add your own * * ** * * * * *** or * loop */



int * ** * ** char ** * * {



int a, i;


* *** ** * a ** **


* * * * * ** * * ** ** * ***


* ** * 0){


* * * * ** * do not ** a *** *** or * *


***


**** *


* ** **


* * * **** **** * ** i);


***


** * * * * * * i);



}


* * 0;



}


* a * * 20


*** *** ***
* *
* * * **
* * * * *
* **
* *
***** *
* ** **
* ** *
****** *** *
** *
* * ***** ***
* * ** * *
* * *
*** * *
** * ** * ***
* * ** **
** ** * *
**** *
**** *** *
50/100 answered by (252 points)
1 like 0 dislike
Hidden content!
1. * * * * * * **** ** ** * * * ** * * Line ** *** **** * ** *** * ** * * Line * * * ** **** do not enter a ** number or ******* Line 15 * * ** * *** *** Line 18 : } else6. Line 19 * *** * * * *** ****** ***** * a number: ** ***** *
* * * ** *
*** * ** *
* ** * ***
* * **
* *** * *
** **** **
** ** * *
* * *
*** *** *
100/100 answered by (268 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.58.96
©2016-2024

Related questions

1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 22, 2017 in Chapter 3: Branching, Looping and Functions by semicolon (5.2k points)
ID: 28184 - Available when: Unlimited - Due to: Unlimited
| 1.4k views
0 like 0 dislike
24 answers
[Exercise] Coding (C) - asked Nov 2, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 30241 - Available when: Unlimited - Due to: Unlimited
| 935 views
1 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 20, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 28130 - Available when: Unlimited - Due to: Unlimited
| 1.3k views
1 like 0 dislike
0 answers
[Resource] asked Oct 16, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 27158 - Available when: Unlimited - Due to: Unlimited
| 17 views
0 like 0 dislike
17 answers
[Exercise] Fill in the blank - asked Nov 26, 2017 in Chapter 3: Branching, Looping and Functions by nat236919 (5.9k points)
ID: 34344 - Available when: Unlimited - Due to: Unlimited
| 499 views
12,783 questions
183,443 answers
172,219 comments
4,824 users