Author Topic: Help ?I think i have a logical error and i can't figure it out :(. please help?  (Read 3340 times)

Toto1991

  • Guest
#include <stdio.h>
#include <stdlib.h>

  int is_prime(int i,int j);
  char contains_one(char number);


  int main (){
      int a,b;
      int i;
      int j;

      printf("\nPlease Enter The Value of X And Y To find the prime numbers between them\n");
      scanf("%d%d",&i,&j);

      a=is_prime(i,j);
      b=contains_one(a);

  return 0;
}



    int is_prime(int i,int j){
        int number;
        for (i=2<j;i<number/2;i++)
        if(number %i==0){
            printf("%d",i);
        }
    }

    char contains_one(char number){

        if (number =='1')
        return number;
        }


a problem to find all the prime numbers between (not including) any two positive integers x and y ( x < y ) and prints to the screen all the prime numbers ( between x and y ) that have the digit 1 (one ) in them. ( i can't figure it out )  using functions

Offline jens

  • Administrator
  • Lives here!
  • *****
  • Posts: 7265
    • Jens' unofficial debian-repository for the Code::Blocks - IDE
Unreleted to C::B and therefore violating our forum rules !!

Please ask in an appropriate forum and not on this site.

Topic locked !!