C program to generate numbers between 1 and 100 which are divisible by 2
Answers
Answered by
10
#include<stdio.h>
int main()
{
int i,n;
for(i=1;i<100;i++)
{
n=i;
if(n%2==0)
printf("\n the values are %d",n);
}
return 0; or [getch();]
}
int main()
{
int i,n;
for(i=1;i<100;i++)
{
n=i;
if(n%2==0)
printf("\n the values are %d",n);
}
return 0; or [getch();]
}
Answered by
2
Answer:
# include < stdio . h >
# include < conio . h >
int main ( )
{
int i ;
clrscr ( ) ;
for ( i = 1 ; i < = 100 ; i ++ )
{
if ( i % 2 == 0 )
{
printf ( " % d " , i ) ;
}
else
{
printf ( " discard it " ) ;
}
return ( 0 ) ;
}
clrscr is used for clearing the screen.
printf is used to print ant message.
for loop is used for doing same job repeatedly.
Similar questions
English,
8 months ago
Geography,
8 months ago
English,
8 months ago
Physics,
1 year ago
Environmental Sciences,
1 year ago
Environmental Sciences,
1 year ago