Page 2 of 6 FirstFirst 12345 ... LastLast
Results 11 to 20 of 55
  1. #11

    Default Re: C/C++ i need help in making a program


    @Tin_Tin: You need not do a search from y to x in order to test for primality. y to x / 2 would be sufficient (if q is very large, you may need to google for more efficient deterministic or probabilistic algos). Also, there's a bug that limits the output to the first two factors of the first composite number. =)

    [ simon.cpu ]

  2. #12
    Senior Member
    Join Date
    Mar 2005
    Gender
    Male
    Posts
    839

    Default Re: C/C++ i need help in making a program

    Hoy simon, panudlo pud uyy....!

  3. #13

    Default Re: C/C++ i need help in making a program

    Quote Originally Posted by simoncpu
    @Tin_Tin: You need not do a search from y to x in order to test for primality. y to x / 2 would be sufficient (if q is very large, you may need to google for more efficient deterministic or probabilistic algos). Also, there's a bug that limits the output to the first two factors of the first composite number. =)

    [ simon.cpu ]
    @simoncpu... i completely agree with u. and i especially liked that "no pain, no glory" part and another thing... altho naa ang solution, but much better if it's fast and efficient


  4. #14

    Default Re: C/C++ i need help in making a program

    bai bisayaa ang program!! kay libog ok ra?? and ok ra if algo ako ihatag?

  5. #15

    Default Re: C/C++ i need help in making a program

    #include<stdio.h>
    void main(){

    int num = 0;
    int input[100];
    int x;

    printf("How many numbers do you want to input?");
    scanf("%d",&num);

    for(x =0; x<num; x++){

    printf("Enter [%d] number:",x + 1);
    scanf("%d",&input[x]);

    }

    printf("\nThe prime Number are:\n\n");
    for(x=0; x<num; x++){
    if(input[x]%2 != 0){
    printf("%d\n",input[x]);
    }
    }
    }

    kana nga program kompleto na jud na!! hasta na pag input!! hehehehe

  6. #16

    Default Re: C/C++ i need help in making a program

    Quote Originally Posted by jerx d great

    printf("\nThe prime Number are:\n\n");
    for(x=0; x<num; x++){
    if(input[x]%2 != 0){
    printf("%d\n",input[x]);
    }
    }
    bai mura di man na prime numbers imo pasabot, mura odd numbers man.

    a prime number is a natural number that has exactly two (distinct) natural number divisors, which are 1 and the prime number itself.

  7. #17

    Default Re: C/C++ i need help in making a program

    number is the range of numbers

    example if you want to know the prime numbers from 1 to 100, number should be equal to 100

    for(int x=1; x<number; x++)
    {
    for(int y=1; y < x; y++)
    {
    if(y%x)
    break;
    }

    if(y == x)
    printf("%d is a prime number", x);

    }

    try daw ni....

  8. #18

    Default Re: C/C++ i need help in making a program

    Code:
        for(int x=1; x<number; x++)
        {
            factor = 0;
            for(int y=1; y <=x/2; y++)
            {
               if((x%y)==0)
                factor++;
               
               if(factor>1)
                break;
             
            }
          
            if(factor==1)
                printf("%d is a prime number", x);
        }
    try ni cya.

  9. #19

    Default Re: C/C++ i need help in making a program

    ok na bro...

    kanang sa conversion of dates into roman numerals..

    kbaw mo?!?!?

  10. #20

    Default Re: C/C++ i need help in making a program

    ah grabeh. wa kay nakat.unan ni sir cayacap?? wahaha

    OT: musta na kim? balik na diri cebu oi

  11.    Advertisement

Page 2 of 6 FirstFirst 12345 ... LastLast

Similar Threads

 
  1. Replies: 5
    Last Post: 03-04-2013, 04:24 PM
  2. Need help in Classic ASP programming
    By afortaliza in forum Programming
    Replies: 4
    Last Post: 12-08-2008, 02:18 PM
  3. Need help in Installing Java programs in my Samsung D880
    By Soj in forum Software & Games (Old)
    Replies: 0
    Last Post: 04-24-2008, 06:34 PM
  4. need help in going to Aparri.
    By mnpesiao in forum Destinations
    Replies: 4
    Last Post: 05-21-2006, 11:16 AM
  5. Want to buy a new mp3 player. Need help in selecting one.
    By metdumangas in forum Gizmos & Gadgets (Old)
    Replies: 21
    Last Post: 01-04-2006, 09:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top