|
-
Nov 4th, 2002, 09:29 PM
#1
Thread Starter
Member
Need help with C homework
I need some help with one of my C programs. Please finish the coding or suggest how I should finish it.
Project 1:
I need to print the prime factorization of two numbers the user puts in. I need to use functions and possibly loops. The output should end up like this:
"The prime factorization of 12 is 2*2*3.
/* My name here
* Page 120; #12
*Purpose: To create a program that will
*take user input of two seperate integers and print
*the prime factorization of the two numbers.
*/
#include <stdio.h>
int primefactor(int number);
int main( void )
{
int usrnum1, usrnum2, usrnumX;
printf("So you want two numbers factored.\n");
printf("Give them to me ne by one and I will do the factoring.\n");
printf("\n Number?");
scanf("%d",&usrnum1);
printf("\nThe prime factorization of %d is ",usrnum1,primefactor(usrnum1));
printf("\n Number?");
scanf("%d",&usrnum2);
printf("\nThe prime factorization of %d is ",usrnum2,primefactor(usrnum2));
scanf("%d",usrnumX);
return 0 ;
}
int primefactor(int number)
{
return printf("\nThe number is %d",number);
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|