510A. Fox And Snake

Problem link


<Source Code>

#include<stdio.h>
void print(long long co,long long m)
{long long i=0,j;
if(co%2==1)
{
for(i=0;i<m-1;i++)
printf(“.”);
if(i==m-1)
printf(“#”);
}
else if(co%2==0)
{
if(i==0)
printf(“#”);
for(i=1;i<m;i++)
printf(“.”);
}
}
int main()
{
long long n,m,i,j,co=0;
scanf(“%lld %lld”,&n,&m);
for(i=1;i<=n;i++)
{if(i%2==0)
{co++;

print(co,m);
}
else{
for(j=0;j<m;j++)
{
printf(“#”);}

}
printf(“\n”);
}
return 0;
}

Advertisements

About waprogramming

I am in CSE,from CUET
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s