Professional Documents
Culture Documents
*2013-5697
*Michelle E. Raterta
* BS ECT-A III
* csit.a */
#include <stdio.h>
#include <string.h>
int main ()
{
int i, Hostages = 5, Counts, target[5], HostageNumber[5] = {0, 1, 2, 3,
4};
char HostageName[5][10];
strcpy (HostageName[0], "Johnny");
strcpy (HostageName[1], "John");
strcpy (HostageName[2], "Jun");
strcpy (HostageName[3], "James");
strcpy (HostageName[4], "Jay");
while(Hostages > 1)
{
printf("\n\n\nEnter the number of counts: ");
scanf("%d", &Counts);
--Hostages;
if (Hostages == 1)
{
printf("\n\n\nOnly Hostage number %s is left.\n\n\n",
HostageName[HostageNumber[0]]);
return 0;
}
}
}
Michelle E. Raterta
Apple Mae P. Sarillana
CSC 101-Csit.A
ALGORITHMS:
Step 1:
Write a program that will store the save hostage into an
array and then will display the output of the last hostage.
Step 2:
Input the number of count.
Step 3:
Any number of counts will be entered
Step 4:
Number %s hostage will be dead and so it follows when we
enter any number of counts
Step 5 :
Number %s will be the output
Step 6:
Save
#include <stdio.h>
#include <string.h>
int main ()
{
int i, j, Hostages, Counts;
while(Hostages > 1)
{
printf("\n\n\nEnter the number of counts: ");
scanf("%d", &Counts);
--Hostages;
if (Hostages == 1)
{
printf("\n\n\nOnly Hostage %s is left.\n\n\n",
HostageName[HostageNumber[0]]);
return 0;
}
}
}