5. Write a C program that gets an Array with 10 3-digits integer IDs. The program then prompts the user to enter his ID, which will be compared to the existing IDs within our Array. If his ID is matched, print “Accepted”, else print “Unaccepted”.

PHOTO EMBED

Fri Aug 18 2023 13:45:22 GMT+0000 (Coordinated Universal Time)

Saved by @Codes

#include <stdio.h>
#include <stdbool.h>

int main() {
    int a[10] = {876,567,423,234,120,678,356,940,366,000};
    int n;
    bool flag = true;
    printf("Enter your ID: ");
    scanf("%d", &n);
    for(int i = 0;i < 10; i++){
        if(a[i]==n){
            flag = false;
        }
 }
 if(flag==true){
     printf("Unaccepted");
 }
 else(flag==false){
     printf("Accepted");
 }

   
    return 0;
}
    
content_copyCOPY