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 :- ...
program for increment & decrement operators
Program for Increment & Decrement Operators Increment operators are divided into 2 types(++). * post increment. ...
Logical Interview Questions2
Logical Interview Questions There are three boxes with fruits: one box with apples, one bo...
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. ...
String functions programs
Program for comparison between two strings :- #include<stdio.h> #include<string.h> main() ...
addition of 2 variables by using dynamic values
Addition of 2 variables by using dynamic values Dynamic values can be changed at run time also. ...
addition of 2 variables by using static values
Addition of 2 variables Static values are constant.we can't change the v...
string examples
#include<string.h> main() { char arr1[9]={'w','e','l','','c','o','m',...
pointer examples
1) Meaning of following simple pointer declaration and definition: int a=5; int * ptr; ptr=&...
0 comments:
Post a Comment