#include <stdio.h> #include <stdlib.h> int main(void) { // Declare and initialize variables. int n, num, sum=0, i, j; //prompting user for input printf("Please enter n followed by n numbers: "); scanf("%d", &n); //for loop for reading in the n amount of numbers for(i=0;i<=n;i++){ scanf("%d", &num); //setting sum to zero sum=0; //for loop for finding factors of num for(j=1;j<=(num/2);j++){ //if the current j is a factor of num, add it to sum if((num%j)==0){ sum+=j; } } //print if number is abundant if (sum>num){ printf("Test case %d: %d is abundant.\n",i+1,num); } //print if numer isnt abundant else{ printf("Test case %d: %d is NOT abundant.\n",i+1, num); } } system("pause"); return 0; }

Any help will be very appreciated

This post has been edited by **sunal135**: 02 February 2013 - 01:12 PM