Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Why this code gives runtime error

$
0
0
#include < stdio.h >
void main()
{
    int i = 0;
    int T;
    int N;
    printf("Enter the 'T' value : ");
    scanf("%d",&T);
    for(i = 0;i<T;i++)
    {
        printf("Enter the 'N' value");
        scanf("%d",&N);
        int number = 1;
        int temp;
        int j = 0;
        for(j=0;j<N;j++)
        {
            printf("Enter values :");
            scanf("%d",&temp);
            number = temp *number;
        }
        j = 1;
        int count = 0;
        for(j = 2;j < number;j++)
        {
            if(number%j == 0)
            {
                count++;
            }
        }
        if(number > 1)
        {
            printf("count = %d\n",(count+2));
        }
        else if(number == 1)
        {
            printf("count = 1\n");
        }
        else
        {
            printf("count = 0\n");
        }
    }
}

Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>