• C

How to get REJECTED to display?

This program suppose to allow the user to enter a social security nummber.
If the number matches on in the list it will display "ACCEPTED."  If it
doesn't match it will display "REJECTED".  To end the program the user
has to enter 000000000.

My problem with this program is when a social security number that does
not match is entered, the program displays nothing.  What could be the

Everything else works fine.

This is my code:

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

void main()

long ssn[8] = {118456835,203658739,444545555,513587652,725468190,7967355113,861490579,921424023};
char buffer[25];
long l;
int x;

printf("\n\nEnter 000000000 to end program.");
printf("\nEnter Social Security Number ===>");


for(x=0; x<=7; x++)


      printf("\nSearch Completed.");

//            if(l!=ssn[x])

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Tommy HuiEngineerCommented:
This section of your code will never be true:

printf("\nSearch Completed.");

Instead you should modify your code to be something like

int found = 0;
for(x=0; x<=7; x++)
    found = 1;

if (found == 0)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.