Total Pageviews

Sunday, November 18, 2012

c program to reverse a number

C Program to reverse a number :- This program reverse the number entered by the user and then prints the reversed number on the screen. For example if user enter 123 as input then 321 is printed as output. In our program we use modulus(%) operator to obtain the digits of a number. To invert number look at it and write it from opposite direction or the output of code is a number obtained by writing original number from right to left. To reverse large numbers use long data type or long long data type if your compiler supports it, if you still have large numbers then use strings or other data structure.



C programming code

 
#include <stdio.h>
 
main()
{
   int n, reverse = 0;
 
   printf("Enter a number to reverse\n");
   scanf("%d",&n);
 
   while (n != 0)
   {
      reverse = reverse * 10;
      reverse = reverse + n%10;
      n = n/10;
   }
 
   printf("Reverse of entered number is = %d\n", reverse);
 
   return 0;
}
 
 
Output of program:
reverse number 
 

JavaScript is a Scripting Language

A scripting language is a lightweight programming language.
JavaScript is programming code that can be inserted into HTML pages.
JavaScript inserted into HTML pages, can be executed by all modern web browsers.
JavaScript is easy to learn.

JavaScript: Writing Into HTML Output

Example

document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph</p>"); 

JavaScript: Reacting to Events

Example

<button type="button" onclick="alert('Welcome!')">Click Me!</button>
                             
     IMPORTANT LINKS TO LEARN MORE

      http://www.w3schools.com/js/default.asp
      http://www.tizag.com/javascriptT/

Monday, November 15, 2010

              ADVANTAGES OF COMMONWEALTH GAMES

Last time we looked at the incredible paced up infrastructure development taking place in Delhi over the recent past in lieu of the Commonwealth Games. We have a new drinking water supply system–Sonia Vihar– providing water to the eastern part of city. We have new sewage system put in place across the city by the authorities. We have an entirely new network of roads and flyovers connecting the city with Domestic and International Terminals. Gurgaon and Jaipur have come closer. We have the Delhi Metro Railway System in place connecting and criss-crossing the Delhi NCR region.
We have renewed focus on solid waste management by local authorities though the Bhagidari scheme. We have put in place over the last few years, airport beautification and expansion, both for domestic and international terminals. We have the existing Indian Railway connecting Delhi to all corners of the country through Rajdhani networks. New sports complexes have come up and existing stadiums renewed.
Then there are the Department of Environment advertisements, showcasing Delhi to be a clean and green city, which has banned the use of plastic bags, which is meeting a good consumer response. Posters of hygienic municipal hazardous waste disposal system for hospital waste are also seen at places. Most recently, the city has seen the Bed and Breakfast possibility in residential area for hosting the guests coming into the city. Construction of the Commonwealth Games Village is on right now and it promises of making the houses available as cheap housing for residents after the Games are over.

Saturday, November 13, 2010

                                                   SHORT HISTORY ABOUT C
                                                                                                                                    Dennis Ritchie, Developer / Inventor of C Programing Language, Unix 

 DENNIS RITCHIE




C (pronounced /ˈsiː/ see) is a general-purpose computer programming language developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system.
Although C was designed for implementing system software, it is also widely used for developing portable application software.
C is one of the most popular programming languages of all time and there are very few computer architectures for which a C compiler does not exist. C has greatly influenced many other popular programming languages, most notably C++, which began as an extension to C.
PROGRAM TO FIND AVERAGE AND SUM OF ARRAY 
#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];
int i,sum=0,n;
float avg;
clrscr();
printf("Enter the array elemtns\n");
for (i=0;i<5;i++)
scanf("%d",&a[i]);
for (i=0;i<5;i++)
{
sum=sum+a[i];
avg=(float)sum/n;
}
printf("\n sum of array elements ===%d",sum);
printf("\n average of array elements === %f",avg);
}

Friday, November 5, 2010

/* Write a program to print fibonacci series */
#include<stdio.h>
#include<conio.h>
void main()
{
int a=1,b=1,c=0,i;
clrscr();
printf(”%d\t%d\t”,a,b);
for(i=0;i<=10;i++)
{
c=a+b;
if(c<100)
{
printf(”%d\t”,c);
}
a=b;
b=c;
}
getch();
}