-->
Showing posts with label hseb solution. Show all posts
Showing posts with label hseb solution. Show all posts

hseb sol17:program to get all even numbers lying between 1 and 100

//program  to print/display all even numbers lying between 1 and 100.
#include<stdio.h>
#include<conio.h>
void main()
{
int k,n;
printf("enter value of 'n'\n");
scanf("%d",&n);
for(k=1;k<=n;k++)
   {
     if(k%2==0)
      {      printf("%d,",k);
      }
  }
getch();
}

hseb16 sol:program to get given star pattern

/*program to get following pattern
      * * * * *
      * * * *
      * * *
      * *
      * 
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
for(i=5;i>=1;i--)
  {
     for(j=1;j<=i;j++)
          {
                printf("* ");
          }
       printf("\n");
 }
getch();
}

hseb solution:Program to get series 1,3,5,7....

//program  to print/display series 1 ,3,5,7,.......nth.
#include<stdio.h>
#include<conio.h>
void main()
{
int k,n;
printf(enter value of 'n'\n");
scanf("%d",&n);
for(k=1;k<=n;k=k+2)
   {          
       printf("%d,",k);
   }
getch();
}