This program is giving Runtime Error in uri, I would like to know where I am going wrong

0
 #include <stdio.h>  
 #include <stdlib.h>  
 #include <math.h>  
 #include <string.h>  

 int main(){
     short int numCasos, i = 1, j = 1, soma = 0;
     long long int num;

     scanf("%hd", &numCasos);

     while(i <= numCasos){
         scanf("%lld", &num);

         while(j <= num){
             if(num % j == 0) soma++;

             j++;
         }

         if(soma == 2) printf("%lld eh primo\n", num);
         else printf("%lld nao eh primo\n", num);

         soma = 0;
         j = 1;
         i++;
     }

     return 0;
    }

Problem description:

In mathematics, a prime number is one that can be divided only by 1 (one) and by itself. For example, the number 7 is prime because it can be divided only by the number 1 and the number 7. Entry

The entry contains several test cases. The first line of the input contains an integer N (1 ≤ N ≤ 100), indicating the number of input test cases. Each of the following N lines contains an integer value X (1

asked by anonymous 05.08.2016 / 20:15

0 answers