WELCOME

Welcome to KoDes4U

Pages

Showing posts with label loop. Show all posts
Showing posts with label loop. Show all posts

Thursday, March 3, 2011

Even Number printig Code(C program)

/*Write a program to find the even numbers from 1 to 100
Coded for KoDes4U.blogspot.com*/
#include
#include
int main()
{
int i;
clrscr();
printf("Even numbers from 1 to 20\n");
for(i=1;i<=20;i++)
{
if(i%2==0)
printf("%d\n",i);
}
getch();
return 0;
}

Friday, February 25, 2011

pattern printing( c-programs)





/*Write a C program to print the following pattern
                          *
                      * *
* * *
                     * * * *         coded by KoDes4u.Blogspot.com*/

#include<stdio.h>
#include<conio.h>
void main()
{
  int i,j,k;
  clrscr();
  for(i=3;i>=0;i--)
    {
      for(j=0;j<i;j++)
        {
          printf(" ");
        }
      for(k=0;k<4-i;k++)
        {
          printf(" *");
        }
        printf("\n");
    }
  getch();
}