Powered By Blogger

Monday, May 2, 2011

Extended Pigeonhole Principle

#include<stdio.h>
#include<conio.h>
void main()
{
    int p,ph,res=0;
    printf("Enter the no. of pigeons : ");
    scanf("%d",&p);
    printf("Enter the no. of pigeon holes : ");
    scanf("%d",&ph);
    res=((p-1)/ph)+1;
    printf("There must be at least %d pigeons in each pigeon hole.\n",res);
    getch();
}

No comments:

Post a Comment