We use cookies to give you the best experience possible. By continuing we’ll assume you’re on board with our cookie policy

HOME A New England Nun Essays String assignment in c language

String assignment in c language

#include<stdio.h>

#include<string.h>

intfactorial(int);

 

intmain()

{

    inti,found=0,n;

 

    charmaster_list[5][20]={

                                  "admin",

                                  "tom",

                                  "bob",

                                  "tim",

                                  "jim"

                              },name[10];

 

    printf("Enter username: ");

    gets(name);

 

    for(i=0;i<5;i++)

    {

        if(strcmp(name,master_list[i])==0)

        {

            found=1;

            break;

        }

    }

 

    if(found==1)

    {

        printf("\nWelcome %s !\n",name);

        printf("\nEnter a good selection to help you compute the actual factorial: ");

        scanf("%d",&n);

        printf("Factorial involving %d will be %d",n,factorial(n));

    }

 

    else

    {

        printf("Error: You are generally possibly not authorized to operated conservation chemistry and biology current information articles and reviews essay program.",name);

    }

 

    // indicator to help doing work system technique went fine

    return0;

}

 

intfactorial(intn)

{

    if(n==0)

    {

        return1;

    }

 

    else

    {

        returnn*factorial(n-1);

    }

}

  
Related Essays

Register in order to Blog through E mail

SPECIFICALLY FOR YOU FOR ONLY$29.34 $3.53/page
Order now