Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Compile and Execute C Online

#include <stdio.h>
int main()
{
    int i,start,dest,fair,n,f[5],sum;
    sum=0;
    f[0]=0;
    f[1]=30;
    f[2]=20;
    f[3]=45;
    f[4]=35;

    printf("\n enter the number of passengers");
    scanf("%d",&n);
    printf("\n station available are:");
    printf("\n 1.shegaon");
    printf("\n 2.paras");
    printf("\n 3.akola");
    printf("\n 4.washim");
    printf("\n 5.hingoli");
    printf("\n select starting station");
    scanf("%d",&start);
    printf("\n select ur destination");
    scanf("%d",&dest);
    switch(start)
    {
        case 1:
        printf("\n STARTING STATION: shegaon");
        break;
        case 2:
        printf("\n STARTING STATION: paras");
        break;
        case 3:
        printf("\n STARTING STATION: akola");
        break;
        case 4:
        printf("\n STARTING STATION: washim");
        break;
        case 5:
        printf("\n STARTING STATION: hingoli");
        break;
    }
    
    switch(dest)
    {
        case 1:
        printf("\t\t ur destination: shegaon");
        break;
        case 2:
        printf("\t\t ur destintion: paras");
        break;
        case 3:
        printf("\t\t ur destination: akola");
        break;
        case 4:
        printf("\t\t ur destination: washim");
        break;
        case 5:
        printf("\t\t ur destination: hingoli");
        break;
    }
    printf("\n no of passengers are:%d",n);
    if(start=dest)
    {
        printf("\n no fair");
    }
    else
    {
        for(i=0;i<dest;i++)
        {
            sum=sum+f[i];
        }
        fair=sum*2*n;
        printf("\n the fair is=%d",fair);

    }
    return(0);
    
}

    
    
    
    
        
        
        
        

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.