Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to get REJECTED to display?

Posted on 1997-12-08
Medium Priority
Last Modified: 2010-04-02
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])

Question by:lawrencej
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 15

Accepted Solution

Tommy Hui earned 150 total points
ID: 1256557
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)


Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question