Computer Science, asked by salahuddinmahmood, 9 months ago

You are given three numbers, "a", "b", and "c". Write a program to determine the largest number that is less than or equal to "c" and leaves a remainder "b" when divided by "a". in python

Answers

Answered by tamaghnadey1916
1

Answer:

import java.util.*;

class abc

{

public static void main()

{

Scanner sc = new Scanner(System.in);

int a,b,c;

System.out.println("Enter 3 numbers");

a=sc.nextInt();

b=sc.nextInt();

c=sc.nextInt();

for (int i=c;i>=(int)Math.min(a,b);i--)

{

if (i%a==b)

break;

}

if (i <(int)Math.min(a,b))

System.out.println ("Not the correct Input to get the desired results");

else

System.out.println (i+" is the result which when divided by "+a+" leaves a remainder "+b);

}

}

Similar questions