Tuesday 22 December 2015

Problem: CPTTRN1

http://www.spoj.com/problems/CPTTRN1/

#include<iostream>
int main()
{
   int t;
   int l,c,i=0,j=0;
   scanf("%d",&t);
   while(t--){
    scanf("%d %d",&l,&c);
    for(i=0;i<l;i++){
    for(j=0;j<c;j++){
    if(i%2==0&&j%2!=0 || i%2!=0 && j%2==0)
    printf(".");
    else
  printf("*");
  }
  printf("\n");} printf("\n");}
   return 0;}

No comments:

Post a Comment