Sunday, December 9, 2012

WAP to print numbers which divided by 6 but divided by 4 also count them 46


#include<stdio.h>
#include<conio.h>
#define p printf
#define s scanf

void main()
{



long int i,sum=0,count=0;
clrscr();

for(i=0;i<=100;i++)
{
if((i%6==0)&&(i%4!=0))
{

sum+=i;
if(i>0)

{
p("\n     +%ld",i);
}

else

{
p("\n       %ld",i);
}


count++;
}

}

p("\n     =%ld\n",sum);
p("\nTotal Values are %ld\n",count);
p("\n\n\tpress any key for exit...");

getch();

}

No comments:

Post a Comment