subject

Write a program in C to fulfil the following requirements. Write a function that will accept an integer as an parameter. Check whether it forms a friendly pair or not. If it forms a friendly pair with a different number then the function will return that number. If the number is not friendly or friend to itself or the given number was negative the function will return 0. (two numbers are friendly if the summation of true factors of the first number is the second one and the summation of true factors of the second number is the first number). The number 6 is friendly to itself hence do not form a friendly pair. The factors of a number that are not equal to the number itself are called “True factors”.
Write a function that will return the LCM of two positive integers sent as parameter. And will return 0 if parameters are invalid.
Design a structure in the program that will have four integers and a real number as its member.
Write a function that will display the information stored in a structure variable of the above type sent as a parameter. All five members should be displayed in a single line, and separated by TAB.
The main function will accept an integer larger than 5000. The program should be able to find all the unique friendly number pairs. (ie. if A, B are found to be friendly, B and A should not be declared again as friendly again).
The first output for a valid input should be the total number of friendly pairs found in the given range.
Then it should display the following information for each of the friendly pairs separated by TAB and in one line for one pair in the format - Smaller one of the friendly pair, Larger one of the friendly pair, HCF or GCD of the friendly pair and LCM of the friendly pair and the average of the friendly pair.
After producing the above output, program should display the integer value equivalent to the bitstring of the average of each of the friendly pair. (Hint. For any of the friendly pair you will get a value that is greater than 1 crore)
The program should waste as less as possible memory space. (Variable declared but not used are waste, if use three variable could solve the problem, but fourth variable were used then fourth variable is wasting memory. Memory kept in reserve assuming that may be needed sometime but not used while program is running, are waste. Memory reserved and used during execution but no longer need it in remaining part of the program are waste)​

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:00, sarah192002
You should hand write your references on your resume.
Answers: 1
image
Computers and Technology, 22.06.2019 11:00, ed72018373
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
image
Computers and Technology, 22.06.2019 14:20, babyrocks7300
Consider a byte-addressable computer with 16mb of main memory, a cache capable of storing a total of 64kb of data and block size of 32 bytes. (a) how many bits in the memory address? (b) how many blocks are in the cache? (c) specify the format of the memory address, including names and sizes, when the cache is: 1. direct-mapped 2. 4-way set associative 3. fully associative
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, kayladgranger
Which demographic challenge is europe currently experiencing? a. an aging and decreasing population b. a baby boomc. an unequal distribution between males and females d. a large group of teenagers moving through the school system(i chose a but i'm unsure)
Answers: 1
You know the right answer?
Write a program in C to fulfil the following requirements. Write a function that will accept an int...

Questions in other subjects:

Konu
Mathematics, 22.04.2021 19:00
Konu
Mathematics, 22.04.2021 19:00
Konu
Mathematics, 22.04.2021 19:00