Monday, October 1, 2018

Prime Numbers Upto 500

#include<stdio.h>
#include<conio.h>
void main()
{
    int i,j,k;
    clrscr();
    for(i=3;i<500;i++)
    {
        for(j=2;j<i;j++)
        {
            k=0;
            if(i%j==0)
            {
            k=1;
            break;
            }
        }
        if(k==0)
        printf("%4d",i);
    }
    getch();


}

Tuesday, November 22, 2016

Factorial of a number using Recursion

Hopefully this code will help you to understand Recursion well.



#include<stdio.h>
#include<conio.h>

long int factorial(long int x)
{
if(x<=0)
return 1;
else
return x*factorial(x-1);
}
void main()
{
long int n,y;
clrscr();
scanf("%ld",&n);
y=factorial(n);
printf("the factorial is:%ld",y);
getch();
}

Sunday, November 20, 2016

Tab pane feature of bootstrap framework

This code will demonstrate the tabbing feature of bootstrap.

 



<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<style>
ul>li
{
padding-top:10px;
padding-bottom:10px;
font-size:24px;   
}
</style>
</head>
<body>
<ul class="nav nav-justified nav-tabs">
<li><a href="#web" data-toggle="tab">Web design</a></li>
<li><a href="#development" data-toggle="tab" >Web development</a></li>
<li><a href="#android" data-toggle="tab">Android Development</a></li>
<li><a href="#IOS" data-toggle="tab">IOS Development</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade text-center" id="web">
<h1>Web design</h1>
<h3>We will learn about css,html,boostrap,js,jquery,angularJS and many other JS frameworks</h3>
</div>

<div class="tab-pane fade text-center" id="development">
<h1>Web Development</h1>
<h3>We will learn about asp.net,php,jsp,laravel,codeigniter and many other frameworks</h3>
</div>

<div class="tab-pane fade text-center" id="android">
<h1>Android development</h1>
<h3>We will learn about XML design,intent,service,activity and many more android programming features</h3>
</div>
<div class="tab-pane fade text-center" id="IOS">
<h1>IOS development</h1>
<h3>We will learn the language objective C,SWIFT and try to have a thorough knowledge of IOS programming</h3>
</div>
</div>
</body>
</html>

Friday, November 18, 2016

Program to create simple image gallery in html css

By using bootstrap  we can create simple image gallery in our web pages.Here is a simple example.







<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>

.col-md-4
{
margin-left:-32px;   
   
   
}
</style>
</head>

<body>
<div class="col-md-4">
<div class="thumbnail text-center">
<img src="Desert.jpg">
<p class="text-center"><h4>We are watching nevada desert</h4></p>
</div>
</div>

<div class="col-md-4">
<div class="thumbnail text-center">
<img src="Lighthouse.jpg">
<p class="text-center"><h4>This is an ancient lighthouse</h4></p>
</div>
</div>

<div class="col-md-4">
<div class="thumbnail text-center">
<img src="Penguins.jpg">
<p class="text-center"><h4>These are beautiful penguins</h4></p>
</div>
</div>
</body>
</html>

Thursday, November 17, 2016

Program to print fibonacci sequence

Here is the following code to print Fibonacci sequence.Hope this code will help a novice programmer.



#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c,d,i;
a=1;
output
b=1;
printf("%6d",a);
printf("%6d",b);

for(i=1;i<=10;i++)
{
c=a+b;
d=b+c;
printf("%3d %3d",c,d);
a=c;
b=d;
}
getch();

}

Program To sort numbers using C

C Program has so many wonderful features.It Can sort data.Here is the following code::

#include<stdio.h>
#include<conio.h>
void main()
{
int a[22],i,j,k;
clrscr();
for(i=1;i<=5;i++)
scanf("%d",a[i]);


for(i=1;i<=5;i++)
{

for(j=1;j<=5-i;j++)
{

if(a[j]>a[j+1])
{
k=a[j];
a[j]=a[j+1];
a[j+1]=k;
}
}
}
printf("\n\n\nThe output is:");
for(i=1;i<=5;i++)
printf("%4d",a[i]);
getch();
}


Hope this code will help you to understand the bubble sorting well.thank u guys.