NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Wed
1
Feb '06

Find the Quarter which a month belongs

I saw so many of my friends writing long long functions for finding the Quarter a month belongs. like if (month > 1 && month < = 3) && (month > … etc.

Here is a simple function for that.

private int getQuarter(int m) 
{
	return ((m - 1) / 3) + 1 ;
}
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Kerala Microsoft Users Group Community Website