The Coding Bus is an educational youtube channel for learning the Free programming languages online. Content includes tutorials and references relating to HTML, CSS, JavaScript, JSON, PHP, Python, AngularJS, React.js, SQL, Bootstrap, Sass, Node.js, jQuery, XQuery, AJAX, XML, Raspberry Pi, C++, and Java
Friday, 9 March 2018
How to make Give Change program in c#
How to make Give Change program in c#
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace bills { class Program { static void Main(string[] args) { Console.Write("Price?"); int prince = Convert.ToInt32(Console.ReadLine()); Console.Write("Paid?"); int paid = Convert.ToInt32(Console.ReadLine()); int remainder = paid - prince; Console.Write("Your change is " + remainder+":"); int i,a,b,c,d,f,g,h; //If the remainder is greater then and equal to 100 then this block is executed. while(remainder>=100) { // we are using the a variable for counting the number of 100 note. a = remainder/100; remainder = remainder%100; // we are using FOR loop for printing the "100" a times. a is the variable. for (i = 1; i <= a;i++ ) Console.Write("100"+" "); } while (remainder >= 50) { b = remainder / 50; remainder = remainder % 50; for (i = 1; i <= b; i++) Console.Write("50" + " "); } while (remainder >= 20) { c = remainder / 20; remainder = remainder % 20; for (i = 1; i <= c; i++) Console.Write("20" + " "); } while (remainder >= 10) { d = remainder / 10; remainder = remainder % 10; for (i = 1; i <= d; i++) Console.Write("10"+" "); } while (remainder >= 5) { f = remainder / 5; remainder = remainder % 5; for (i = 1; i <= f; i++) Console.Write("5"+" "); } while (remainder >= 2) { g = remainder / 2; remainder = remainder % 2; for (i = 1; i <= g; i++) Console.Write("2"+" "); } while (remainder >= 1) { h = remainder / 1; remainder = remainder % 1; for (i = 1; i <= h; i++) Console.Write("1"+" "); } Console.ReadLine(); } } }
Subscribe to:
Posts (Atom)
😍Developer on Weekends #shorts #officememes #developermemes
😍Developer on Weekends #shorts #officememes #developermemes Welcome to the latest viral YouTube shorts meme for developers! 😍Developer on...
-
How to create a free online course website with WordPress in 2019 In this video, I'm going to show you how to create an online course...
-
How to make a Piano App in MIT App Inventor 2 How to make a Piano App in MIT App Inventor 2 Download Code-: https://ift.tt/2VbH8Bu via You...
-
Privacy Policy Minzor built the 3d wallpapers app as a Free app. This SERVICE is provided by Minzor at no cost and is intended for use as is...