IMPLEMENTING LOOPING STATEMENT
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,i;
clrscr();
printf("\n Enter the value of a \n");
scanf("%d",&a);
printf("The Number of series is.....");
for(i=0;i<=a;i++)
{
printf("%d\n",i);
}
i=1;
printf("\n The odd series is ....");
while(i<=a)
{
if(i%2!=0)
printf("%d",i);
i=i+1;
}
i=1;
printf("\n The Even series is......");
do
{
if(i%2==0)
printf("%d",i);
i=i+1;
}while(i<=a);
getch();
}
CODING:
#include<stdio.h>
#include<conio.h>
void main()
{
int a,i;
clrscr();
printf("\n Enter the value of a \n");
scanf("%d",&a);
printf("The Number of series is.....");
for(i=0;i<=a;i++)
{
printf("%d\n",i);
}
i=1;
printf("\n The odd series is ....");
while(i<=a)
{
if(i%2!=0)
printf("%d",i);
i=i+1;
}
i=1;
printf("\n The Even series is......");
do
{
if(i%2==0)
printf("%d",i);
i=i+1;
}while(i<=a);
getch();
}
No comments:
Post a Comment