Saturday, 31 January 2015

Program to display the circular shift of an array at Nth position.

//Program to display the circular shift of an array at Nth position.

#include<iostream.h>
#include<conio.h>
void main()
{
 int a[5],temp,n,i,j,b;
 clrscr();
cout<<"Enter the 5 elements in array:";
      for(i=0;i<5;i++)
cin>>a[i];
cout<<"Array elements are:\n";
        for(i=0;i<5;i++)
cout<<a[i]<<" ";
cout<<"\nEnter the position from which you want to shift";
cin>>b;
i=0;j=b;
while(i<j)
{
temp=a[i];
for(i=0;i<4;i++)
a[i]=a[i+1];
a[i]=temp;
i++;
 j--;
}
cout<<"\Now array elements are \n";
for(i=0;i<=5;i++)
cout<<a[i]<<" ";
getch();
 }

Wednesday, 28 January 2015

Write a program to take input parameters and data for a table and display the desired table.

<!--Write a program to take input parameters and data for a table and display the desired table.-->

<html>
<head>
<title>Table</title>
<script type=text/javascript>

function createtable()
 {
  var x = document.createElement("TABLE");
  var no_of_rows=parseInt(window.prompt("Enter the no. of rows"));
  var no_of_cols=parseInt(window.prompt("Enter the no. of column"));
  x.style.border = 1;
  x.style.borderStyle = "solid";
  for(i=0;i<no_of_rows;i++)
  {
var new_row = document.createElement("tr");
x.appendChild(new_row);
for(j=0;j<no_of_cols;j++)
{
var new_col = new_row.insertCell(j);
var input = window.prompt("Enter value for cell (" + i + "," + j + "):");
new_col.innerHTML = input;
new_col.style.border = 1;
new_col.style.borderStyle = "solid";
new_row.appendChild(new_col);
}

   }

   document.body.appendChild(x);

}

</script>
</head>
<body onload="createtable();">
</body>
</html>

Tuesday, 27 January 2015

Javascript program to find factorial of N number using recursion.

<!--Program to find factorial of N number using recursion.-->

<html>
<head>
 <title>Factorial</title>
  <script type = "text/javascript">
    var n = parseInt(window.prompt("Enter the Number:"));
    var result = fact(n);
      window.alert("Factorial of the given number " + result);
      function fact(n)  
       {
        if(n == 0) 
        {
         return 1;
        } 
        else 
        {
         return n * fact(n - 1);
        }
       }
</script>
</head>
<body>
</body>
</html>

Sunday, 25 January 2015

Javascript program to calculate/find factorial of n number,until entered 0.

<!--Program to calculate factorial of n number, until entered 0-->

<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a=1;
for(;n!=0;)
 {
  n=1;
  var n=prompt("Enter a number to calculate its factorial");
  {
   for(var i=1;i<=n;i++)
   {
    a=a*i;
    document.write(a+" ");
   }
   document.write("<br/> ");
   a=1;
  }
  document.write(" ");
 }
</script>
</head>
<body>
</body>
</html>

Saturday, 24 January 2015

Javascript program to print the following pattern (for n input lines).

<!--Javascript program to print the following pattern (for n input lines).-->
<!--when n=4-->

10 09 08 07
06 05 04
03 02
01 


<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a;
var b=10;
var n=prompt("Enter a number for no. of rows in a pattern.");
for(var i=n;i>=1;i--)
 {
  for(var j=1;j<=i;j++)
   {
    if(j==1 && i==n)
    document.write(b+" ");
    else
    document.write("0"+b+" ");
    b--;
   }
   document.write("<br />");
 }
</script>
</head>
<body>
</body>
</html>

Javascript program to print the following pattern (for n input lines).

<!--Javascript program to print the following pattern (for n input lines).-->
<!--when n=4-->>

01
01 02
01 02 03
01 02 03 04 



<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
var a;
var n=prompt("Enter a number for the no. of rows in a pattern");
for(var i=1;i<=n;i++)
 {
  for(var j=1;j<=i;j++)
   {
    document.write("0"+j+" ");
   }
   document.write("<br />");
 }
</script>
</head>
<body>
</body>
</html>

Friday, 23 January 2015

Program to enter the element in array at Nth position in C++

//Program to enter the element in array at Nth position.

#include<iostream.h>
#include<conio.h>
void main()
{
 int a[10],i,j,m,n,k;
 clrscr();
 cout<<"Enter the length of array:\n";
 cin>>n;
 cout<<"Enter no of elements:\n";
 for(i=0;i<n;i++)
 cin>>a[i];
 cout<<"Enter the position k:\n";
 cin>>k;
 cout<<"Enter the element you want to insert:\n";
 cin>>m;
 for (j=n;j>=k-1;j--)
   {
    a[j+1]=a[j];
    a[j]=m;
   }
   n=n+1;
   for(i=0;i<n;i++)
   cout<<"\n"<<a[i];
  getch();
 }

Multiplication of two values using Inline function in c++

//Multiplication of two values using Inline function.

#include<iostream.h>
#include<conio.h>
class Line
{
public:
inline float mult(float x,float y)
{
return(x*y);
}
       };
void main()
{
 clrscr();
 Line obj;
 float val1,val2;
  cout<<"Enter two values for its Multiplication\n";
  cout<<"a= ";
  cin>>val1;
  cout<<"\nb= ";
  cin>>val2;
  cout<<"Multiplication of a and b is "<<obj.mult(val1,val2);
  getch();
 }

Program to show Armstrong number between 1 to 1000 in C++

//Program to show Armstrong number between 1  to 1000.

#include<iostream.h>
#include<conio.h>
void main()
{
 int arm=0;
 int cube,rem,temp,i;
 clrscr();
 cout<<"Program to show Armstrong no. b/w 1  to 1000:\n";
 for(i=1;i<=1000;i++)
   {
    temp=i;
    arm=0;
    while(temp!=0)
    {
     rem=temp%10;
     temp=temp/10;
     arm=arm+(rem*rem*rem);
    }
    if(arm==i)
     cout<<arm <<" ";
   }

  getch();
}

Thursday, 22 January 2015

Program to print a Pattern

//Program to print the following Pattern.

    1
   121
  12321
 1234321
123454321

#include<iostream.h>
#include<conio.h>
void main()
{
 int i,j,k,l;
 clrscr();
  for(i=1;i<=5;i++)
    {
      for(k=1;k<=5-i;k++)
{
cout<<" ";
}
      for(j=1;j<=i;j++)
       {
cout<<j;
       }
       for(l=i-1;l>=1;l--)
       {
cout<<l;
       }
      cout<<"\n";
    }
 getch();
}

Wednesday, 21 January 2015

OOPS Assignment

For OOPS Assignment, Click on the below link.

Program to find the Longest Increasing Series

//Program to find the Longest Increasing Series.

#include<iostream.h>
#include<conio.h>
void main()
{
 int no,temp,i;
 int temp2=0;
 int max=0;
 int j=0;
 clrscr();
 cout<<"Enter 10 number to check longest:\n";
 for(i=1;i<=10;i++)
  {
   cin>>no;
   if(no>max)
    {
     max=no;
     j=j+1;
     temp=j;
    }
    else
     {
      j=1;
      if(temp2<temp)
      {
       temp2=temp;
      }
      max=no;
     }
   }
     if(temp2>j)
     cout<<"Longest series is: "<<temp2;
     else
     cout<<"Longest series is: "<<j;

   getch();
}

Tuesday, 20 January 2015

Javascript Page to add two number

<!--Javascript Page to add two number-->

<html>
<head>
<title>
Addition
</title>
<script type="text/javascript" >
var a;
var b;
var c;
a=window.prompt("Enter first no.");
b=window.prompt("Enter second no.");
a=parseInt(a);
b=parseInt(b);
c=(a+b);
window.alert("Sum of "+a+" and "+b+" is "+c);
window.confirm("Is your answer correct");
document.write("");
</script>
</head>
<body>
<em>Program to add two number.</em>
</body>
</html>

HTML and CSS page showing layout of Facebook Timeline

<!--HTML and CSS web design of Facebook Timeline (About)-->

<html>
<head>
<title>Akshay Sarda</title>
</head>
<style ="text/css">

#container

{
 width:100%;
 background-color:#E3E3EC;
 height:880px
}
#header
{
 width:100%;
 height:40px;
 background-color:506786;
 background-attachment:fixed;
 float:left;
 border-radius:2px;
 position:fixed;
 z-index:1;
}
#logo
{
 width:15%;
 height:35px;
 float:left;
 margin-left:10px;
 margin-top:2.5px;
 font-size:30px;
 color:white;
 }
#search
{
 width:50%;
 height:35px;
 margin-top:10px;
 float:left;
}
#name
{
 width:20%;
 height:35px;
 float:left;
 margin-top:8px;
 font-size:20px;
 color:white;
 font-width:2px
}
#blank
{
 width:160px;
 height:750px;
 float:left;
 margin-top:2.5px;
 font-size:20px;
 background-color:none;
 margin-top:50px;
}
#timeline
{
 width:800px;
 height:300px;
 float:left;
 margin-top:8px;
 background-image:url("01.jpg");
 background-repeat:no-repeat;
 border:1px solid;
 boder-color:506786;
 position:relative;
}
#side
{
 width:370px;
 height:270px;
 float:left;
 margin-top:8px;
 position:relative;
 margin-top:50px;
}
#recent
{
 width:220px;
 height:250px;
 float:right;
 margin-top:none;
 background-color:white;
 text-align:center;
 border:1px solid;
 boder-color:506786;
}
#links
{
 height:50px;
 width:800px;
 float:left;
 background-color:white;
 border:1px solid;
 border-color:506786;
 border-radius:2px;
 margin-top:0px;
}
#time
{
 height:100%;
 width:37%;
 float:left;
 text-align:right;
 border:1px solid;
 border-color:506786;
 font-size:20px;
 color:506799;
}
#about
{
 height:100%;
 width:12.29%;
 float:left;
 text-align:center;
 border:1px solid;
 boder-color:506786;
 font-size:20px;
 color:506786;
}
#load
{
 width:800px;
 float:left;
 margin-top:2px;
}
#overview
{
 width:800px;
 height:60px;
 float:left;
 margin-top:20px;
 border:1px solid;
 border-color:506786;
 background-color:f1f1f1;
 color:506786;
 font-size:48px;
}
#box
{
 width:800px;
 height:365px;
 float:left;
 background-color:white;
 color:506786;
 }
#view
{
 width:250px;
 height:365px;
 float:left;
 background-color:white;
 color:506786;
 font-size:20px;
 border:1px solid;
 border-color:506786;
}
#detail
{
 width:546px;
 height:365px;
 float:left;
 background-color:white;
 color:506786;
 font-size:20px;
 border:1px solid;
 border-color:506786;
}
#inner
{
 width:300px;
 height:365px;
 float:left;
 background-color:white;
 color:506786;
 font-size:16px;
 margin-left:20px;
}
#inn
{
 width:110px;
 height:365px;
 float:left;
 background-color:white;
 color:506786;
 font-size:16px;
 margin-left:15px;
}
#side1
{
 width:350px;
 height:500px;
 float:right;
 margin-top:8px;
 }
#online
{
 width:220px;
 height:300px;
 float:left;
 margin-top:none;
 background-color:white;
 text-align:center;
 border:1px solid;
 boder-color:506786;
}
</style>
<body style="margin:0 auto">
<div id="container">
<div id="header">

<div id="logo">
<em>Facebook</em></div>

<div id="search">
<form>
<input type="text" value="Search" size="80">
</form></div>

<div id="name">

Akshay | Home
</div>

</div>


<div id="blank">
</div>

<div id="timeline" style="margin-top:50px;">

<div style="margin-left:10px; margin-top:190px;">
<img src="02.jpg" width=19% height=44% style="position:relative; border:1px solid; border-color:506786; border-radius:2px;"/>
</div>
</div>

<div id="side">

<div id="recent">
Recent Activities
</div>
</div>

<div id="links">

<div id="time">
<div style="float:right; height:90%; width:50%; margin-top:11px; margin-right:32px;"> Timeline </div>
</div>

<div id="about">

<div style="float:left; height:90%; width:90%; margin-top:11px;"> About </div>
</div>

<div id="about">

<div style="float:left; height:90%; width:90%; margin-top:11px;"> Friends </div>
</div>

<div id="about">

<div style="float:left; height:90%; width:90%; margin-top:11px; "> Photos </div>
</div>

<div id="about">

<div style="float:left; height:90%; width:90%; margin-top:11px; margin-right:auto; margin-left:auto;"> More </div>
</div>

<div id="about">

<div style="float:left; height:90%; width:90%; margin-top:11px;">  </div>
</div>
</div>

<div id="load">


<div id="overview">

<b>&nbsp;&nbsp;&nbsp;&nbsp;About</b>
</div>

<div id="box">

<div id="view"><br/>
Overview<br/><br/>
Work and Education<br/><br/>
Places You've Lived<br/><br/>
Contact and Basic Info<br/><br/>
Family and Relationships<br/><br/>
Details About You<br/><br/>
Life Events<br/>
</div>

<div id="detail">

<div id="inner">
<br/>
Student
<br/><br/><br/><hr/>
Studies BCA at Jaipur National University<br/>
Past: L K Singhania ,Gotan and global public school,kota<br/>
<br/><hr/><br/>
Lives in Jaipur, Rajasthan<br/>
From Jaipur, Rajasthan<br/><br/><hr/>
</div>

<div id="inn">

<br/>
Phones<br/>
09876543210<br/>
Email<br/>
akshay@gmail.com<br/>
akshay1@facebook.com<br/>
Birthday<br/>
October 31, 1995
</div>
</div>
</div>
</div>
</body>
</html> 

Program to read 10 number and count how many of them are even or odd using only three variables in c++

//Program to read 10 number and count how many of them are even or odd using only three variables  in c++

#include<iostream.h>
#include<conio.h>
void main()
{
 int i,a,even=0;
 clrscr();
 cout<<"Enter 10 no. and check even and odd:\n";
  for(i=1;i<=10;i++)
  {
   cin>>a;
   if(a%2==0)
    even=even+1;
  }
  cout<<"There are"<<even<<" even number";
  cout<<"\nThere are"<<10-even<<" odd number";
  getch();
}

Program to read 10 number and print both Max and Min in c++

//Program to read 10 number and print both Max and Min in c++

#include<iostream.h>
#include<conio.h>
void main()
{
 int a,i;
 int max=0;
 int min=0;
 clrscr();
 cin>>a;
 min=a;
 for(i=1;i<=9; )
  {
   if(a>max)
     max=a;
   else if(a<min)
     min=a;
   i++;
   cin>>a;
  }
  cout<<"Max= "<<max;
  cout<<"\nMin= "<<min;
  getch();
}

Program to find Palindrome in c++

//Program to find Palindrome in c++

#include<iostream.h>
#include<conio.h>
void main()
{
 int a,b,p;
 int i=0;
 clrscr();
 cout<<"Enter a number to check palindrome:\n";
 cin>>a;
 p=a;
 while(a!=0)
  {
   b=a%10;
   a=a/10;
   i=(i*10)+b;
  }
 if(i==p)
 cout<<"Number is Palindrome";
 else
 cout<<"Number is Not Palindrome";
 getch();
}

Program to find whether the number is Super Palindrome or Not in C++

//Program to find whether the number is Super Palindrome or Not in C++

#include<iostream.h>
#include<conio.h>
void main()
{
 int a,b,p;
 int i=0;
 clrscr();
 cout<<"Enter a number to check Super Palindrome:\n";
 cin>>a;
 p=a;
 while(a!=0)
  {
   b=a%10;
   a=a/10;
   i=(i*10)+b;
  }
 if(i==p)
 {
  p=p*p;
  int sp,j=0,c;
  sp=p;
  while(p!=0)
   {
    c=p%10;
    p=p/10;
    j=(j*10)+c;
   }
   if(j==sp)
    cout<<"Number is Super Palindrome";
   else
    cout<<"Number is Not Super Palindrome";
 }
   else
   cout<<"Number is Not Super Palindrome";
 getch();
}

Program to find Third maximum out of four number without using array in C++

//Program to find Third Maximum out of four number without using array in C++

#include<iostream.h>
#include<conio.h>
void main()
{
 int a,b,c,d;
 int max=0;
 int smax=0;
 int tmax=0;
 int fmax=0;
 int no1=0;
 int no2=0;

 clrscr();
 cout<<"Enter Four Number to find tmax out of it: ";
 cout<<"\na= ";
 cin>>a;
 cout<<"\nb= ";
 cin>>b;
 cout<<"\nc= ";
 cin>>c;
 cout<<"\nd= ";
 cin>>d;

 if((a>b)&&(a>c)&&(a>d))
  {
   max=a;
  }
 else if((b>c)&&(b>d)&&(b>a))
  {
   max=b;
  }
 else if((c>d)&&(c>b)&&(c>a))
  {
   max=c;
  }
 else
  {
   max=d;
  }
//first largest
 if(max==a)
  {
   smax=b;
   tmax=c;
   fmax=d;
  }
 else if(max==b)
  {
   smax=a;
   tmax=d;
   fmax=c;
  }
 else if(max==c)
  {
   smax=a;
   tmax=b;
   fmax=d;
  }
 else if(max==d)
  {
   smax=a;
   tmax=b;
   fmax=c;
  }
 if((smax>tmax)&&(smax>fmax))
  {
   max=smax;
  }
 else if((tmax>fmax)&&(tmax>smax))
  {
   max=tmax;
  }
 else
  {
   max=fmax;
  }
//second heighest
 if(max==smax)
  {
   no1=tmax;
   no2=fmax;
  }
 else if(max==tmax)
  {
   no1=smax;
   no2=fmax;
  }
 else
  {
   no1=smax;
   no2=tmax;
  }

//third largest
 if(no1>no2)
  {
   max=no1;
  }
 else
  {
   max=no2;
  }


cout<<"\n\nThird max= " <<max;


getch();
}

Read contacts in iOS using Swift with error handling

Just copy and paste the below code Pre-step before pasting the below code Add below line in AppDelegate.swift file below import statement ...