c#  Condtion to only accept Multiples of 20's....

Posted on 2011-04-25
Last Modified: 2012-05-11
i want to put a condition that  the user can only withdrawal multiples of 20's.  how would i do this?

i tried something like    if(  input    !=  input %20)  but that only letting accept 2 . . so it only letting type the remainder 20.     if i put it == , it just ignores all completely, b/c i put 35 and it goes thru still.
Question by:Ajs135
    LVL 39

    Accepted Solution

    if ( input %20 == 0)
                      Response.Write("True : accept");
    Response.Write("False : reject");

    LVL 10

    Expert Comment

    pratima@ is right actually input %20 this means divide input on 20 and if it will divide completely means no remainder then you have multiple of 20 so

    if(input %20 == 0) will work fine


    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now