Horrible Program question

This is a discussion on Horrible Program question within the C Programming forums, part of the General Programming Boards category; see the attachment http://cboard.cprogramming.com/attac...1&d=1217262034...

  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    9

    Horrible Program question


  2. #2
    Registered User
    Join Date
    Jul 2008
    Posts
    9
    Code:
    #include <stdio.h>
    #include <math.h>
    
    main(){
    	int a,b,p;
    	for(a=1;a<=p-1;a++){
    		printf("&#37;d\t",a);
    		for(b=1;b<=p-1;b++){
    				if(a*b%p==1){
    				printf("%d\n",b);
    				break;
    			}
    		}
    	}
    }

  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    9
    but, how can u get rid of "the distractions of performing real arithmetic accurately"?

  4. #4
    * noops's Avatar
    Join Date
    Jun 2008
    Posts
    108
    Maybe p should be set to something.

  5. #5
    Registered User
    Join Date
    Jul 2008
    Posts
    9
    maybe there is misunderstanding of the question.
    i think, "in this way the distractions of performing real arithmetic accurately on the computer will be avoided." means p is a prime but not a constant???

    if we set p=17,
    how can we "store" the inverses of non-zero elements of F?

  6. #6
    * noops's Avatar
    Join Date
    Jun 2008
    Posts
    108
    I think we are missing some information. The link in your first post did not work for me.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. newb question: probs with this program
    By ajguerrero in forum C Programming
    Replies: 5
    Last Post: 04-19-2006, 09:04 AM
  2. Random Question Assign Program
    By mikeprogram in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2005, 10:04 PM
  3. I'm not ask for ENTIRE program, only 1 Question !
    By Th3-SeA in forum C Programming
    Replies: 10
    Last Post: 10-01-2003, 01:33 PM
  4. Question type program for beginners
    By Kirdra in forum C++ Programming
    Replies: 7
    Last Post: 09-15-2002, 06:10 AM
  5. Replies: 8
    Last Post: 03-26-2002, 07:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21