6. Write a Program that show all the Even Number between 1 to 100.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=1;
printf("The Even Numbers between 1 to 100 are:");
while(i<=100)
{
if(i%2 == 0)
printf("%d\t",i);
i++;
}
getch();
}
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=1;
printf("The Even Numbers between 1 to 100 are:");
while(i<=100)
{
if(i%2 == 0)
printf("%d\t",i);
i++;
}
getch();
}
_________________________________________________________________________________
7. Write a Program for count the odd and even Number respectively between 100 to 500.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=100, even=0, odd=0;
while(i<=500)
{
(i%2 == 0)? (even = even+1) : (odd = odd+1);
i++;
}
printf("The Even Number = %d",even);
printf("\n Odd Number=%d", odd);
getch();
}
_________________________________________________________________________________
8. Write a Program that show all the odd Numbers between 1 to 100.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=1;
printf("The Odd Number between 1 to 100 are:"
);
while(i<=100)
{
if(i%2 !=0)
printf("%d\t", i);
i++;
}
getch();
}
_________________________________________________________________________________
9. Write a Program to Print Number 1 to 100.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i;
for(i=0; i<100;i++)
{
printf("%d\t",i)
}
getch();
}
_________________________________________________________________________________
10. A Program that Accept a Number from User and Print its Table.
Answer :
#include<stdio.h>
#include<conio.h>
Void main()
{
int i=0, t;
printf("Enter the Number for Table:");
scanf("%d",&t);
while(i<=10)
{
printf("%d\t", t*i);
i++;
}
getch();
}
*********************************************************************************
0 comments:
Post a Comment