Question

Write a C function that determines whether its parameter, which is an integer number has a...

Write a C function that determines whether its parameter, which is an integer number has a specific mathematical characteristic. Then, call the function from inside a main function. The mathematical characteristic will be given to you (*), along with some examples.

this is all that was given

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

#include <stdio.h>
void math_char(int);

int main()
{  
int n;
printf("Enter a number:");
scanf( "%d",&n);
math_char(n); // function calling

return 0;
}
void math_char(int n)
{
int r;
r= n*n;
printf("The result of %d * %d is %d", n,n,r);
}

Output

Add a comment
Know the answer?
Add Answer to:
Write a C function that determines whether its parameter, which is an integer number has a...
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
  • In C++ Write a function that receives an integer array with its size and determines whether...

    In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.

  • In C++ Write a function that receives an integer array with its size and determines whether...

    In C++ Write a function that receives an integer array with its size and determines whether the array is already sorted in increasing order. Write a test program (main function) that prompts the use to enter a list and displays whether the list is sorted or not. The first number in the input indicates the size of the list. Assume the maximum list size is 20.

  • Question 3 (10 marks) An integer number is said to be a perfect number if its...

    Question 3 (10 marks) An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because its factors, except itself, are 3, 2, and 1, and 6 = 3+2+1, but 12 is not a perfect number because its factors, except itself, are 6, 4, 3, 2, and 1, but 12 # 6+4+3+2+1. First. Write a C function, called isperfect, that...

  • Write a C++ function that inputs a positive integer and determines whether it is prime using...

    Write a C++ function that inputs a positive integer and determines whether it is prime using trial division and find as many primes of the form n2+1 , where n is a positive integer, as you can. c++/discrete structure

  • C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all...

    C++ 2. (a) Write a function, printdixisors, that takes a single integer parameter and prints all the numbers less that the parameter that are divisors of the parameter (i.e. divides it without a remainder) including 1. So printdivisors(6) will print 1,2,3. Note you may use a wrapper function or default parameters. (b) Write a function, sumdixisors, that takes a single integer parameter and returns the sum of all the divisors of the parameter (including 1). So sumdivisors(6) will return 6...

  • Write a function PoundsToKilograms that: Takes a number of pounds (an integer) as a parameter, Calculates...

    Write a function PoundsToKilograms that: Takes a number of pounds (an integer) as a parameter, Calculates and returns the corresponding value in kilograms. 1 kilogram is equal to 2.2 pounds. In the main section of the program: Prompt the user to input a weight in pounds, Call the function you wrote to transform the weight into kilograms, Output the weight in kilograms; the number must be shown with 2 decimals after the decimal point. Your program must define and call...

  • Task 4: a) Write a function named change() that has an integer parameter and six integer...

    Task 4: a) Write a function named change() that has an integer parameter and six integer reference parameters named hundreds, fifties, twenties, tens, fives, and ones. The function is to consider the passed integer value as a dollar amount and convert the value into the fewest number of equivalent bills. Using the reference parameters, the function should alter the arguments in the calling function. b) Include the function written in part a in a working program. Make sure your function...

  • C++ 1) Write a function named WordCount, which determines the number of words in a “C...

    C++ 1) Write a function named WordCount, which determines the number of words in a “C type” string. The function will have one parameter (the address of the string) and will return the number of words (words are separated by one or more spaces). (15 points) 2) Write a function named VowelConsonant which will have three parameters - all “C type” strings. The function will place all vowels (the characters a, e, i, o, u) from the first string into...

  • in C++ and also each function has its own main function so please do the main...

    in C++ and also each function has its own main function so please do the main function as well. Previously when i asked the question the person only did the function and didn't do the main function so please help me do it. 1-1. Write a function that returns the sum of all elements in an int array. The parameters of the function are the array and the number of elements in the array. The function should return 0 if...

  • In ASCII C programming write a function that determines if an integer is prime. A prime...

    In ASCII C programming write a function that determines if an integer is prime. A prime number is one that is not divisible by any number other than one and itself. int isPrime(long num); Return 1 if num is prime, 0 if not. As above, make this a pure function contained in its own file isPrime.c and test it with a separate tester program. To test if an integer is prime you could implement a loop that generates trial divisors...

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