0

Plz help me Accept a number and check whethe it is divisible by 3 and 5 or 5 and 3.

using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace divisible { class program { static void Main(string[] args) { int num; Console.WriteLine("Enter the Number:"); num=Convert.ToInt32 (Console.ReadLine()); if (num % 3==0 && num%5==0) { Console.WriteLine("divisible by 3 and 5"); } if( num % 3==0) { Console.WriteLine("Divisible by 3"); } else { Console.WriteLine("Not Divisible by 3"); } if( num % 5==0) { Console.WriteLine("Divisible by 5"); } else { Console.WriteLine("Not Divisible by 5"); } Console.ReadLine(); } } } 12-div by 3 15- div by 3 and 5 10- div by 5 7-not div by 3 and 5.

14th Apr 2020, 2:23 PM
neha
1 Odpowiedź
+ 1
First try it yourself, and post your try if you struck in between.. Edit: Thanks for the try, & adding code.. neha Its working fine.. What else do you need..? I think you got your answer...!
14th Apr 2020, 4:26 PM
Jayakrishna 🇮🇳