Questions: 1 978

Answers by our Experts: 1 850

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a C program to check whether the given number is odd or even using if,if else

enter the code:


 Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.

#include <stdio.h>


int main(int argc, char *argv[]) {
	
	int a, b;
	
	// Obtain values for a and b
	printf("Enter the value for integer a: ");
	scanf("%d", &a);
	printf("Enter the value for integer b: ");
	scanf("%d", &b);
	printf("\n\n");
	
	// Compare a and b
    if (a == 42 && b == 216)
    {
        printf("Password correct");
    }
	else if (a > b)		      // Testing for a greater than b
	{
		printf("a (%d) is bigger than b 0(%d)\n", a, b);
	}
	else if (a == b)      // Testing for equality
	{
		printf("a (%d) is equal to b (%d)\n", a, b);		
	}
	else				  // Otherwise a must be less than b
	{
		printf("a (%d) is less than b (%d)\n", a, b);		
	}
	
 	system("pause");
	return 0;
}


Enter the code:


Enter a value of a that is equal to b.

int main(int argc, char *argv[]) {
	
	int a, b;
	
	// Obtain values for a and b
	printf("Enter the value for integer a: ");
	scanf("%d", &a);
	printf("Enter the value for integer b: ");
	scanf("%d", &b);
	printf("\n\n");
	
	// Compare a and b
	if (a > b)		      // Testing for a greater than b
	{
		printf("a (%d) is bigger than b 0(%d)\n", a, b);
	}
	else if (a == b)      // Testing for equality
	{
		printf("a (%d) is equal to b (%d)\n", a, b);		
	}
	else				  // Otherwise a must be less than b
	{
		printf("a (%d) is less than b (%d)\n", a, b);		
	}
	
	system("pause");
	return 0;
}





loop



#include <stdio.h>


int main()
{
    int n=100;
    
    for(int i=100;i>=0;i--){
        printf("%d\n",i);
    }


    return 0;
}


  • Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.



Enter the Code:

int main(int argc, char *argv[]) {
	
	int a, b;
	
	// Obtain values for a and b
	printf("Enter the value for integer a: ");
	scanf("%d", &a);
	printf("Enter the value for integer b: ");
	scanf("%d", &b);
	printf("\n\n");
	
	// Compare a and b
	if (a > b)		      // Testing for a greater than b
	{
		printf("a (%d) is bigger than b 0(%d)\n", a, b);
	}
	else if (a == b)      // Testing for equality
	{
		printf("a (%d) is equal to b (%d)\n", a, b);		
	}
	else				  // Otherwise a must be less than b
	{
		printf("a (%d) is less than b (%d)\n", a, b);		
	}
	
	system("pause");
	return 0;
}


 Write a short reflective account of the code concentrating on its functionality and comparing the outputs against the source code.


Create a program just like about a simsimi. You ask a question and the computer will answer it directly.(Atleast 10-20 question)

Create a program that will display magic square of numbers based on a given odd magic square size. A magic square is a square array of numbers consisting of the distinct positive integers 1,2, …, arranged such that the sum of the numbers in any horizontal, vertical, or main diagonal line is always the same number, known as the magic constant. The program should ask the user to enter an odd integer that will serve as the size of the square. The program should validate if the entered number is an odd or even number. If the number is even, the program should display an error message and ask the user to enter a number again. Once a valid size is entered, the program should automatically display the magic square.



Create a program that will display magic square of numbers based on a given odd magic square size. A magic square is a square array of numbers consisting of the distinct positive integers 1,2, …, arranged such that the sum of the numbers in any horizontal, vertical, or main diagonal line is always the same number, known as the magic constant. The program should ask the user to enter an odd integer that will serve as the size of the square. The program should validate if the entered number is an odd or even number. If the number is even, the program should display an error message and ask the user to enter a number again. Once a valid size is entered, the program should automatically display the magic square.





Create a C program that stores 10 integers. Print the maximum and the minimum integer found in the array.



Create a program that stores 10 integers. Print the maximum and the minimum integer found in the array.

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS