Search This Blog

Translate

c program to print first 10 natural number square but stop as soon as divisible 2,3,4 is encountered

c program to print first 10 natural number square but stop as soon as divisible 2,3,4 is encountered

#include"stdio.h"
#include"conio.h"
void main()
{
int i,no;
clrscr();
printf("Square of first 10 natural number is=\n\n");
for(i=1;i<=10;i++)
{
no=i*i;
if((no%2==0)&&(no%3==0)&&(no%4==0))
{
printf("\n\n Series stop !!Because %d is divisible of 2,3,4 !!",no);
break;
}
else
{
printf(" %d",no);
}
}
getch();
}





c program to print first 10 natural number square but stop as soon as divisible 2,3,4 is encountered

C Program example List

Google+ Badge