Write a program to generate prime factors of a given integer?
Answer Posted / kalee
Pseudo code: Algorithm ....
If N is the integer, then, any number greater than sqrt(N) will not be a factor of that integer...
so it is enough to check till sqrt(N) integers, that is it is divisible or not... further, if N is odd... forget all the even integers, as they cannot be a part of factors.. :)
Happy coding...
| Is This Answer Correct ? | 6 Yes | 9 No |
Post New Answer View All Answers
What do you mean by a local block?
What are structure members?
What are disadvantages of C language.
Define macros.
What is s or c?
the number of measuring units from a arbitrary starting point in a record area or control block to some other point a) branching b) recording pointer c) none d) offset
What is this infamous null pointer, anyway?
If you know then define #pragma?
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
What is a memory leak? How to avoid it?
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
What is an array? What the different types of arrays in c?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
What are enums in c?
what are # pragma staments?