Computer Science, asked by zkarthiksriram3377, 8 months ago

Daenerys is very much interested in watching car racing. Once while doing so, this is what she observes that Car 1 is coming so fast. The road on which the car comes is divided into three. There are three roads A, B, and C. Each road is given some number. Before the car reaches the end of the road, she wants to know the road in which the car will travel. Help her in finding in which road the car will travel? INPUT & OUTPUT FORMAT: Input consists of 4 integers. First input corresponds to the number of road A. Second input corresponds to the number of road B. Third input corresponds to the number of road C. Fourth input corresponds to the number of cars. If the car cannot travel on any road, display "No path exist".

Answers

Answered by shubhamtripathigis32
6

Answer:

#include<stdio.h>

int main()

{

 int road_a,road_b,road_c,no_of_cars;

 scanf("%d%d%d%d%d",&road_a,&road_b,&road_c,&no_of_cars);

 if((road_a%no_of_cars) == 0) {

   printf("Car 1 goes into road A");

 }

 else if((road_b%no_of_cars) == 0) {

   printf("Car 1 goes into road B");

 }

 else if((road_c%no_of_cars) == 0) {

   printf("Car 1 goes into road C");

 }

 else {

   printf("No path exist");

 }

}

#The Answer in c#

Answered by nancychaterjeestar29
0

Answer:

#include<stdio.h>

#include<conio.h>

int main()

{

float road1,road2,road3,CountOfCars;

scanf("%f%f%f%f",&road1,&road2,&road3,&CountOfCars);

if((road1%CountOfCars) == 0) {

  printf("Car 1 goes into road A");

}

else if((road2%CountOfCars) == 0) {

  printf("Car 1 goes into road B");

}

else if((road3%CountOfCars) == 0) {

  printf("Car 1 goes into road C");

}

else {

  printf("No path exist");

}

}

#SPJ2

Similar questions