Saturday, 8 December 2012

goto statement in c program | simple goto example in c

goto statement in c program | simple goto example  in c

In this article we are going to learn how to work with goto statement in c programming language.
Basically goto is jump statement which means we can go one point or functionality to another functionality  in same function or within function. for  that we use goto statement.

#include<stdio.h> // including header files
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter the no");
scanf("%d",&n);
if(n % 2==0)
goto even;  // will goto even
else
goto odd;
even:printf("even"); // will print if number is even
odd:printf("odd");
getch();

Addition of two numbers in c program with source code.

Addition of two numbers in c program with source code.


In this article we are going to learn how to add two number entered by user in c programming language using function.
create function  and initialize that function and call that function by passing parameter you want to add.

#include<stdio.h>
void main()
{
  int a,b;
  clrscr();
  printf("\n Enter 2 Number:"); // user will enter two number one by one
  scanf("%d %d",&a,&b); // number will store in variable a and b.
  printf("\Addition=%d",add(a,b)); //calling  function add
}
  int add(int x,int y)  // in function add passed two parameter x and y.
  {
    return(x+y);  // adding two number
  }
return will  give output.

Thursday, 6 December 2012

Palindrome program | logic | examples source code | c++

Palindrome  program | logic | examples source code | c++

After reversing if  you are getting same  number it means you are reversing palindrome number.
to reverse the all digit and get same number is symbol of palindrome number.
Lets take examples
121  after reverse it  we will get 121. so we can say 121 is palindrome number.same is with 999=999.
12=21 not palindrome number .Have you seen mirror same functionality is working here.
But here is digit not your  face.so we are going to learn about palindrome number and execution.
we  can reverse string also like did=reverse(did)=did but i dont know about  words just think about digits .ok i think there is enough explanation now time is to do something real .
Let's concentrate to source code in c program.sorry about c language we are going to learn c++.everything is same in c just little about scanf and printf

How to write c++ palindrom number Program with source code


int pali(int);  // function name pali
void main()
{
int n,a;
clrscr();
cout<<"\n enter the number=";
cin>>n;  // accepting number from user
a=palindrom(n);
if(n==a)  // cheking after reversing number is same or not
cout<<"\n number is palindrom";  // yes it is
else
cout<<"\n number is not palindrom";  //no  it is not
getch();
}
int palindrom(int x) //
{
int r,sum=0;
while(x!=0) // till number will there
{
r=x%10; taking mode so we can get at least one number

sum=sum*10+r;   //addition
x/=10; //division
}
return(sum);//function calling
}

in  c or c++ do execution with your own .execution will give you correct logic and method to understand program logic.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.
  1. when error comes like this after executing  asp.net website.
  2. simple way to get rid of this problem is just remove app_offline.htm.
  3. how to remove app_offline.htm file  the question comes .
  4. whenever this query will comes just go to solution explorer and delete app_offline.htm file.
  5. after deleting that file just again refresh website and press F5 to run the program again.

Queristring in vb.net with example | how to use queristring in asp.net

Queristring in vb.net with example | how to use queristring in asp.net

how to use queristring in vb.net .
if we want to pass the information from one page to another IN  .aspx page
in c# or vb.net we need some object which will give flow of data from
one page to another page.so , that is session and queristring.
in this article we will learn how to use response.redirect  to pass data from one page to another page.
Response.Redirect("Default.aspx?from=" & txtfrom.Text & "  &to=" &
txtto.Text & " &last=" & txtlast.Text)
 queristring do same functionality in c# and vb but using syntax is little bit different.
in c# we use + sign whereas in vb we use & sign.
Response.Redirect("Default2.aspx?from=" & txtfrom.Text & "  &to=" &

txtto.Text & " &last=" & txtlast.Text)

above code shows that passing value from first default.aspx to
default2.aspx. where variable from is storing data of txtfrom text box
and to is storing txtto text box value .this value will go to the
default2.aspx where we can utilize that values.

so lets start page 2 default2.aspx.
 we can store from and to value in other variable for use purpose.
 Dim sr as integer
sr=from
Dim dr as integer
dr=to

and we can use it any where on same page .
but remember about  " " and & & sign . many developers like me find difficulties to solve this problem.

basic problem comes when we need to pass more than one paramater then we think about syntax  like where to use & and  '" and "","".
there are very small , simple and very useful think. so , do it very carefully. Don't play with it just work with it.