Thread: smallest coin

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    222

    smallest coin

    I am trying to find the amount here.
    Input

    The first line of input contains an integer M, the number of coins in bank.
    The second line of input contains M integers: coin1, coin2... coinN. coini represents ith coin.

    Output
    Print smallest possible amount of cash that you will not be able to pay in super market.

    Code:
    int solution(int count_coin, int coin[count_coin])
    {
            float coin1=0.50,total=0.0;
    	int ncoins;
    	printf("Number of 50 coins : ");
    	scanf("%d",&ncoins);
    	total += (ncoins * coin1);
    	printf("** %.2f **",total);
            return;
    }
    Last edited by leo2008; 01-08-2022 at 08:50 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2008
    Posts
    222
    I am trying to solve this in c programming, maybe the logic that I provided is not working as expected.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sum up the largest and smallest ones
    By programmer1 in forum C Programming
    Replies: 8
    Last Post: 11-08-2011, 11:35 AM
  2. Replies: 22
    Last Post: 05-29-2009, 05:44 PM
  3. need to find smallest int
    By lankeveil in forum C Programming
    Replies: 3
    Last Post: 11-30-2008, 05:48 AM
  4. largest and smallest
    By eldemonio in forum C Programming
    Replies: 9
    Last Post: 10-15-2007, 02:00 PM
  5. smallest int problem
    By jms318 in forum C Programming
    Replies: 13
    Last Post: 12-05-2006, 03:52 PM

Tags for this Thread