# C Programming – HackerRank Solution | Shirdi Sai Temple |

### (HackerRank) Write a Modular C Programming code to solve Shirdi Sai Temple, Shirdi Sai Temple is one among the most visited places for worship in India.

Shirdi Sai Temple is one among the most visited places for worship in India.

The number of devotees visiting the temple each day is very high, the head of the temple has to monitor the devotees and are allowed with a specific preference to worship each day.

Today is another crowdie day, head of the Shirdi Sai temple thought to apply certain protocol to manage the devotees.

First, he allowed all the devotees to stand in a line in first come last served basis.

Then he identified the devotee whose age is most among all and allowed him/her to worship.

Input Format

First Line – N – indicates number of devotees.

Second Line – age of the devotees.

Constraints

N should be positive value between 1 to 100.

Age should be positive value 1 to 200.

Output Format

First line – Age of devotee allowed for worship.

Second line – Age of remaining devotees.

Sample Input 0

```5
50 25 34 54 12
```

Sample Output 0

```Allowed for worship: 54
Remaining devotees: 12 34 25 50
```

Sample Input 1

```1
50
```

Sample Output 1

```Allowed for worship: 50
No devotees to worship.```

CODE:

```#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>

struct node
{
int data;
};
typedef struct node *NODE;
{
{
printf("No devotees to worship.");
}
else{
printf("Remaining devotees: ");
while(cur!=NULL)
{
printf("%d ",cur->data);
}
}
}
{
NODE newnode=malloc(sizeof(struct node));
scanf("%d",&newnode->data);
}
{
NODE prev=NULL;
NODE PREV=NULL;
while(cur!=NULL)
{
{
PREV=prev;
max=cur;
}
prev=cur;
}
else
printf("Allowed for worship: %d\n",max->data);
free(max);
}
int main() {
int n,i;
scanf("%d",&n);
for(i=0;i<n;i++)
{
}
return 0;
}
```

OUTPUT

```Congratulations, you passed the sample test case.

Click the Submit Code button to run your code against all the test cases.

Input (stdin)

5
50 25 34 54 12

Allowed for worship: 54
Remaining devotees: 12 34 25 50
Expected Output

Allowed for worship: 54
Remaining devotees: 12 34 25 50```

Please find some more codes of Loops, Condition Statements, 1D Arrays, 2D Arrays, Strings, Pointers, Data Structures, Files, Linked lists, Stacks, Queues, Binary Trees, MISC, Solved model question papers & Hacker Rank all solutions on the below page:

Top 100+ C Programming codes – KLE Technological University