EASY 2 LEARN 'C'
Home
DotNet
Thursday, 30 August 2012
Check prime number up to 100
C
heck prime number up to 100
:-
#include<stdio.h>
main()
{
int n,i,count;
for(n = 1;n<=100;n++)
{
count = 0;
for(i=2;i<=n/2;i++)
{
if(n%i==0)
{
count++;break;
}
if(count==0 && n!= 1)
printf("%d ",n);
}
return 0;
}
}
0 comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Search Box
'C' Language
'C' Programming
(27)
Arrays in 'C'
(5)
Interview Que's about 'C'
(8)
Strings in 'C'
(4)
Popular Posts
Differences
Difference between Programming and assembly language Programming Language :- ...
strings in c-language
STRINGS String :- A string is a collection of characters. Strings are always en...
Reverse floyds triangle
Reverse floyds triangle :- #include<stdio.h> main() { int i,j,k; i=7; for(j=3...
Sections and Rules in 'C'
Sections in 'C' :- Sections are divided into 7 types, * Documentation Section. ...
a program for do-while loop
A program for do-while loop syntax :- { ...
check addresses are correct or not
/* cosider 3 variables and find the addresses ,first two variables addresses difference is equal to another two variables ...
Constants of "c"
CONSTANTS Definition :- a number represent...
addition of 2 variables by using static values
Addition of 2 variables Static values are constant.we can't change the v...
loops
Loops of C-Programming language Loop is a statement, it calls itself more than one time, when the conditi...
program for increment & decrement operators
Program for Increment & Decrement Operators Increment operators are divided into 2 types(++). * post increment. ...
0 comments:
Post a Comment