Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

My program

Posted by scdxlhy at 2004-10-02 12:36:34 on Problem 1663
#include<stdio.h>

int Is_even(int n)
{
	if(n % 2 == 0)
		return 1;
	else
		return 0;
}

int main()
{

	int coordinates[100][2], number;

	scanf("%d", &number);
	while(number-- > 0)
	{
		scanf("%d%d", &coordinates[number][0], &coordinates[number][1]);
//		printf("%d%d", coordinates[number][0], coordinates[number][1]);
		if(Is_even(coordinates[number][0]) == 1 && Is_even(coordinates[number][1]) == 1)
			printf("%d\n", coordinates[number][0] + coordinates[number][1]);
		else if(Is_even(coordinates[number][0]) == 0 && Is_even(coordinates[number][1]) == 0)
			printf("%d\n", coordinates[number][0] + coordinates[number][1] - 1);
		else
			printf("No Number\n");
	}

	return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator