Monday, April 14, 2014

Nested Number Character Pyramid

Q. Write a C program to print the following nested number-character pyramid/pattern as:

A
1
BB
22
CCC
333

Ans.

/*c program for nested number character pyramid*/
#include<stdio.h>
int main()
{
 int num,r,c,z,n=1;
 char ch=A;
 printf("Enter Maximum number : ");
 scanf("%d", &num);

 for(r=1; r<=num; r++,ch++,n++)
 {
  for(c=1; c<=2; c++)
  {
   if(c%2==0)
   {
     for(z=1; z<=r; z++)
        printf("%d",n);
   }
   else
   {
     for(z=1; z<=r; z++)
        printf("%c",ch);
   }
   printf("
"
);

  }
 }
 getch();
 return 0;
}


/**************************************************************
The output of above program would be:
**************************************************************/


Output for Nested Number Character Pyramid C program
Figure: Screen shot for Nested Number Character Pyramid C program


Related programs:

1. Nested same Symbol Pyramid as:

   #
   #
   ##
   ##
   ###
   ###

2. Nested Differ Symbol Pyramid as:

   @
   #
   @@
   ##
   @@@
   ###

3. Nested Equal same-equal Pyramid as:
   
   @
   @
   ##
   ##
   @@@
   @@@

4. Nested Equal Number Pyramid as:

   1
   1
   22
   22
   333
   333

5. Nested Differ Character Pyramid as:
   
   A
   A
   BB
   BB
   CCC
   CCC
Continue reading

Sunday, April 13, 2014

Need To Step Up Your Game Read These Tips!

By Alejandro Sison


Do you remember opening your first video game system as a child? The anticipation of blowing up bad guys or virtually flying a plane? I do, and ever since, video games have been a fun hobby Ive enjoyed in my spare time. Read on to find out how you can make gaming even more fun!

Be aware of the hidden dangers of online gaming. There can be an annual or monthly fee to play. Always check out any monthly video game site that children are interested in joining. Find out if there are any fees, and if so, whether the game is worth it.

A lot of online games these days offer players the option to earn new content or rewards by slowly working hard at it or by purchasing it. Look into the purchases required for some games. On one hand, there is not much more enjoyment in playing. These will also save you a lot of your precious time.

Playing video games is a great way to relax after a tough day at work or at school. Dont let a difficult level on a video game detract from this relaxing activity. Even the most experienced gamers sometime need a cheat code to help get through an exceptionally hard level. On the Internet, there are some great sites that provide cheat codes and strategy guides for various video games.

Parents should take the time to look in the game consoles settings for parental controls. Consoles will have these controls within their settings menus. These can allow you to control games by ESRB rating, the amount of time on the system and limit online access. With these controls set, your child can play games more safely.

If you have a child that loves video games, make sure you set up some limits. Clearly express how much time a child can invest in one day and stick to it. You can also use video games as a reward when your child completes chores around the house. For example, you could set up a system where each chore they do gives them ten minutes of game time.

Whether its to occupy your download time or even something you do socially, video games are a great way to have fun affordably and harmlessly. You can relieve stress, feel accomplished and yet never leave your own home.




About the Author:



Continue reading

A C PROGRAM TO FIND VOWELS COUNT

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

void main()
 {
   char letter;

   int vowel_count = 0;
   clrscr();
   
   for (letter = A; letter <= Z; letter++)
     switch (letter) {
       case A:
       case E:
       case I:
       case O:
       case U: vowel_count++;
     }; 

   printf("The number of vowels is %d
", vowel_count);

   getch();
 }

Continue reading

Saturday, April 12, 2014

Web Creation Speaking Of Robert Jain Credit Suisse

By Rob Sutter


If you are running a business and want it to attain as much information as possible, a web presence is needed. This goes for every industry that you can possibly think of, investment banking being seen amongst them. As important as this may be for Robert Jain Credit Suisse, for example, Id like to think that there are certain qualities that should be focused on more than others. Here are just a couple of qualities that can prove to be most helpful when it comes to design in particular.

To start off, you want to choose a typeface that you will be able to make heads or tails of easily. This is important because it seems like there are a few fonts, while nice-looking in their own right, which may not bode well in terms of a coherent design. What is the type of font that should be utilized then, you may wonder? Instead of working with a font that is elegant, why not go with one that is solid and does not require much effort, if any, to make out?

If you are going to go about webpage creation, you have to take into account the color schemes as well. You want to make sure that it is easy enough on the eyes so that users are going to stay on the pages for longer periods of time. What this means is that the color combination should not be intense so working with a white background along with black text, typically, is going to be the one that is preferred the most. This, in my opinion, will keep eye strain at a low level.

Navigation should be noted as well and you can be certain that Robert Jain Credit Suisse will support such a point as well. The directions that are seen with various pages will have to be easy to make out so that a user will be able to move from one section of a site to the next. The truth of the matter is that unless navigation is seen at a high level, not many people are going to stay around for long. This is an example of strong navigation that names such as Jain can support.

With so much importance tied to web design, I think that there are certain points which can stand at the forefront more than others. Robert Jain Credit Suisse can attest to the idea of a web presence being important but it should be formed in such a way that it can be seen as effective. There are a number of elements to consider, color and text being seen on the appearance side of things. Navigation should be easy enough to implement as well so that moving from one page to the next is simple.




About the Author:



Continue reading

Computer Repair Service Plantation FL

By Jaclyn Hurley


The utilization of workstations for individual and in addition business exercises is on the ascent. Innovation is exceptionally alterable that, what is in vogue today gets outdated tomorrow. Different units are intended for utilization in different circumstances. Like whatever available machines, workstations will breakdown and oblige adjusting sooner or later. However, with computer repair service Plantation FL people have the hardware problems handled.

These units are distinctive and everyone is intended for its motivation. A sample is the console; this mechanism is made up of keys of letters and numbers for composing the names and entering in numbers when ascertaining. We additionally have others like the light pen which uses light to compose straightforwardly on the screen, the screen which is the presentation unit, the preparing unit which goes about as the PC mind.

The nature of the administrations of the firm you will captivate for the work will be controlled by the capabilities of the specialists. Those organizations that put more attention on the accreditation of the workers are prone to offer better administrations. Require some investment to check how qualified these representatives are, and how great they are in the work.

Knowing the careful reason for the issue can help you spare cash as the expert will invest less time in the conclusion. There are qualified individuals who can render attractive administrations for your machines. They are remarkably dedicated in determining both equipment and programming issues.

The disc drive; this serves to peruse the data spared on the disc and react as needs be. The data spared on the disc may be as pictures, music or content. The point when this data is decoded, it is shown on the screen for the clients to pick what they need to view. The data may be so substantial there is no option fit in the disc and may require to be spared in a DVD. For the clients to view this on the screen, they oblige a DVD drive.

The mouse is the indicating unit in the machine. This unit has two catches that is the right and the left. The point when the driver focuses on a symbol, he or she then twofold clicks on the left catch to view the substance in the icon.

Assuming that there are no professionals in your city to give machine repair services you look for different choices on the web. This permits you to think about different administration suppliers regarding the administrations and the expense. Audits posted by past clients can help in settling on a choice about the professional to captivate.

Computer mending experts will give you tips to deal with the CPU and their adornments which will bring down their expenses of upkeep. Guarantee to have the support administration given on a normal foundation by the same singular if conceivable. They will likewise help you to purchase the best supplies to help you in your information handling necessities. The expense of the administrations ought to be moderate and inside your plan.




About the Author:



Continue reading

Friday, April 11, 2014

CURRENT TIME

A C program to print Current time



main()
{
printf("Current time is: %s",__TIME__);
}
Continue reading

ALL PERFECT SQUARE BELOW 1000

/*PROGRAM TO PRINT ALL PERFECT SQUARES BELOW 1000*/
#include<stdio.h>
main()
{
int i=1;
printf("The perfect squares below 1000 are
");

while(i*i<1000)
{
printf("%5d",i*i);
i++;
}
getch();
}
Continue reading

Thursday, April 10, 2014

An Overview Of Cloud Computing Services Chicago Agencies

By Leanne Goff


Cloud computing services Chicago agencies have for a long time been a god send for many organizations. Firms in need of IT solutions that have engage these companies have always had a good story to tell after the completion of overhauls conducted by these professionals. The city boasts of a great number of agencies that a client could approach, however, certain factors ought to always be considered.

Below are some of the most important features that characterize agencies of this nature and the tasks they perform. Having these pointers at hand would ensure that a client has a good idea of what he or she is getting into at all times. Knowing exactly what the organization needs at a particular time, for example, would also be a good thing.

The above factor basically forms the foundation of this search contemplated here. Once the needs of the client have been clearly set out, the next step would be to look around for the available agencies that could cater for these needs. This mini-search here ought to be aimed at settling for agencies that specialize on the needs of the client.

One of the areas in which a business, especially one that is just starting out, would need help would be on the IT overhaul or networking department. Here, the business may need to establish a working network that would connect all the departments of the business. In this area, only professionals would be best placed to conduct the overhaul or the installation.

A strong client base is an important asset to any organization. This is where the revenues, profits and goodwill of the business would come from. A business could engage a professional firm to embark on an intense online marketing campaign that would see to it that the business grows its client base to a certain level.

Apart from online advertising, a company could also engage these firms for the sole purpose of establishing a vibrant website for the business. Experts based in such firms could help especially a starting business to create a working website that would later translate to an increased clientele. In this way, the client would be able to achieve organizational goals in place.

The goal of realizing profits and getting good investment returns is among one of the most important business goals. SEO gears, which at times entail those discussed in the previous paragraphs, could be utilized by a business to achieve these goals. These gears enable an organization to rank high on the lists that are normally generated by search engines.

The establishment of fast and clear internet connectivity would also enable an organization achieve its goals. This factor could also be considered as part of the big SEO tools umbrella. Cloud computing services Chicago companies could create such connectivity for an organization. All these advancements could be procured, but only if a client has this basic information at hand at all times.




About the Author:



Continue reading

Wednesday, April 9, 2014

Benefits Of Construction Project Management Software

By Jaclyn Hurley


Developing property in the building industry is a task that can be daunting and if the right procedures are not used. A lot is required to make this venture successful. Time, resources and money need to be managed carefully. Construction project management software is a computer program that might be used to manage a venture easily. These programs are highly efficient allowing investors in the industry to work efficiently.

This innovation is literally very efficient and can give maximum results with limited time constraints. This means that they give instant results because they are readily programmed. Employees working on a task can be able to share information easily thus encourages cooperation. Moreover, accurate information is readily available to all staffs working for a project which helps to prevent confusion.

The computer programs could be customized to meet the needs of different kinds of clients. This is extremely important because all aspects of the building could be covered. A client can specify their need to the developers and get their own configured system. With these specification targets can easily be met at minimum time and cost.

With proper training of employees; the usage of the computer programs becomes easy and fast. They are developed in such a way that staff could be able to use them to their benefits. The market offers a wide range of programs and clients can choose the ones that could be easily used. Training on how to use the programs does not consume a lot of time ensuring that work commences immediately.

The team being trained will determine the amount of time that can be taken for training. A team that is active and learns fast will acquire skill at a faster rate. With the use of these programs; learning is continual as a person continues to learn the software. This series are easily accessible to those who are interested. A large number of tasks can be done at the same time hence improving time management further.

Time that is taken to perform time consuming tasks is greatly reduced. This is because they are made in such a way that they can perform a task to its exact specification. Computers do not get tired hence many tasks can be done repeatedly until targets are met. There is no room for mistakes with the use of computer programs. Although mistakes may be there, they are highly reduced.

Furthermore, the building innovation allows data to be saved in back-up hard drive for safety. This guarantees the safety of information for a building plan. Also, only necessary information is shared among the experts thus preventing leaked of data that will undermine the patent of a building. Only authorized personnel can be given the password to access such privileged information.

Information about construction management software is easily available on the internet and developers workstations. All investors in the construction business are highly recommended introducing these programs. Investors are guaranteed of good results. All the parties that are involved in construction including engineers, contractors, and architects will find these programs useful. In a project everyone involved should be at par with the computer programs.




About the Author:



Continue reading

Virtual Functions and Run time Polymorphism

Before beginning this I would like to tell you one thing through the following
program:



// Virtual Functions and
// Run-time Polymorphism
#include <iostream.h>

// base class
class base
{
public:
int a;
};

// derived class
class derived:public base
{
public:
int b;
};

// main
void main()
{
base b;
derived d;

// base class pointer
base *bptr;

// pointer pointing
// to bases object
bptr=&b;

bptr->a=10;

// pointer pointing
// to deriveds object
bptr=&d;

// still is able to access
// the members of the base
// class
bptr->a=100;
}


The property above combined with virtual function can be used to achieve a
very special and powerful feature, known as run-time polymorphism.


We had discussed about What
is Polymorphism
before so we wont be discussing it here.


The program below illustrates how virtual functions can be used to achieve
run-time polymorphism.


Please read the code carefully so that you understand how it’s working.



// Using Virtual functions to
// achieve run-time Polymorphism
#include <iostream.h>

// base class
class base
{
public:
virtual void func()
{
cout<<"Bases func()
"
;
}
};

// derived class
class derived:public base
{
public:
void func()
{
cout<<"Deriveds func()
"
;
}
};

// main
void main()
{
int ch=0;

base b;
derived d;

// base class pointer
base *bptr;

while(ch!=3)
{
cout<<"1> Call Bases func
"
;
cout<<"2> Call Deriveds func
"
;
cout<<"3> Quit
"
;

cin>>ch;

switch(ch)
{
case 1:
// point to bases object
bptr=&b;
break;

case 2:
// point tp deriveds object
bptr=&d;
break;

default:
bptr=&b;
}

// call whichever function
// user has chosen to call
bptr->func();
}
}


Related Articles:


Continue reading

Tuesday, April 8, 2014

DATA STRUCTURES APTITUDE


  •                  What are the methods available in storing sequential files ?

Ø  Straight merging,
Ø  Natural merging,
Ø  Polyphase sort,
Ø  Distribution of Initial runs.

  •          List out few of the Application of tree data-structure?

Ø  The manipulation of Arithmetic expression,
Ø  Symbol Table construction,
Ø  Syntax analysis.
  •       List out few of the applications that make use of Multilinked Structures?

Ø  Sparse matrix,
Ø  Index generation.

  •                       In tree construction which is the suitable efficient data structure?

            (a) Array           (b) Linked list              (c) Stack           (d) Queue   (e) none

(b) Linked list

  •                What is the type of the algorithm used in solving the 8 Queens problem?

            Backtracking

  •                In an AVL tree, at what condition the balancing is to be done?

            If the ‘pivotal value’ (or the ‘Height factor’) is greater than 1 or less than –1.

  •                  What is the bucket size, when the overlapping and collision occur at same time?

            One. If there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. This results in the overlapping of values.



  •             There are 8, 15, 13, 14 nodes were there in 4 different trees. Which of them could have formed a full binary tree?

15.
In general:
            There are 2n-1 nodes in a full binary tree.
By the method of elimination:
Full binary trees contain odd number of nodes. So there cannot be full binary trees with 8 or 14 nodes, so rejected. With 13 nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 15.
Note:
            Full and Complete binary trees are different. All full binary trees are complete binary trees but not vice versa.



  •              Sort the given values using Quick Sort?


           
65
70
75
80
85
60
55
50
45

            Sorting takes place from the pivot value, which is the first value of the given elements, this is marked bold. The values at the left pointer and right pointer are indicated using Land R respectively.     

65
70L
75
80
85
60
55
50
45R

Since pivot is not yet changed the same process is continued after interchanging the values at L and R positions

65
45
75 L
80
85
60
55
50 R
70
                       
65
45
50
80 L
85
60
55 R
75
70

65
45
50
55
85 L
60 R
80
75
70


65
45
50
55
60 R
85 L
80
75
70
                       
When the L and R pointers cross each other the pivot value is interchanged with the value at right pointer. If the pivot is changed it means that the pivot has occupied its original position in the sorted order (shown in bold italics) and hence two different arrays are formed, one from start of the original array to the pivot position-1 and the other from pivot position+1 to end.

60 L
45
50
55 R
65
85 L
80
75
70 R

55 L
45
50 R
60
65
70 R
80 L
75
85

50 L
45 R
55
60
65
70
80 L
75 R
85

In the next pass we get the sorted form of the array.

45
50
55
60
65
70
75
80
85


Continue reading

Intel and the OLPC

I was shocked this last week to discover that when Intel left the One Laptop Per Child project, many people immediately used this as an opportunity to say that OLPC is finished, done for, kaput. Why, just because one of their most recently joined partners was ousted? Their other partners include Quanta, Chi Mei, AMD, News Corp, Google, Brightstar, Red Hat, Nortell, Marvell, eBay, SES/Astra, Citigroup, Real Networks, Seagate, Adobe, and more.

Seriously, it seems like people want this project to fail and Im not sure why. I am a proponent many of the ideas that are intrinsic to the XO laptop and the software it comes with, so Im rooting for it to be a success. I even participated in their Give One Get One program, and Im eager waiting for my very own green and white XO laptop.

Some people think that because Intel is also selling laptops to education ministries in poor countries that this dooms OLPC. I hope theyre wrong. Intel is selling what amounts to power guzzling Windows laptops. They arent rugged enough, they need AC power to run, and they run Windows and Microsoft Office. In other words they are only in the market to kill OLPC and they dont care the least little bit about benefitting children.

A lot of other people trash the OLPC because it isnt useful to them personally. This is just a nonsensical position to take. It isnt designed for the affluent consumer but for education starved kids in poor countries out in the bush. It fulfills its intended role perfectly. It is designed specifically to open a world of learning to kids, and not just give them boring drill and repetition games. Why do American consumers tolerate boring educational software BTW?

The OLPC is a completely open platform with a designed-for-kids collaborative GUI and built in wireless mesh networking, special BitFrost security, and very radical learning software. It is uncompromising in executing the vision it sets forth. Very cool.

Some people criticize OLPC saying that kids dont need computers, but clean water and food. There are already many charities striving to provide those things. Why is it wrong for another charity to enrich their minds?

I encourage everyone to go to http://video.google.com/ and search for OLPC or Negroponte. There are some excellent long presentations that explain all the important ideas of OLPC.
Continue reading

Monday, April 7, 2014

New Working Method of Making Blogger Title Tags SEO Friendly

New Working Method of Making Blogger Title Tags SEO Friendly


[Blogger made some recent changes on 9th May 2008 which
enables us to use a simple method to make SEO Friendly Title Tags for Post Pages
(Permalink Pages), I guess I am a bit too late to notice but as we’re
discussing about Web Programming lately, I’ll share the method anyway.]


One of the biggest problems I face with Blogger blogs is the inability to create
custom SEO and human friendly title tags. Blogger does not give us any option
to change the way title tags are in post pages. Titles of post pages in Blogger
are always in the following form:


[Blog Title] : [Post Title]


In this case when you have a bit long Blog Name, all your pages in the Search
Engine index would start with the blog name taking most of the previous space.
That way it wouldn’t be relevant to the content of the post in most cases


The following form of title would be considered good:


[Post Title] : [Blog Title]


Or if your blog’s name is too long you can use just the title:


[Post Title]


People have always been trying to come up with ways to create custom title
tags in Blogger, some used a hack few months back known as the Widget Based
Title Tag hack which NO longer works from quite some time. Even I used that
method here on my blog. But, as I said, after sometime Blogger wouldn’t
let that hack work. Again some people found a slightly different method that
WORKED but pissed off the HTML compliance really bad as title tag was placed
outside of the <head> tag. So the fact is before 9th May there really
was no way you could have custom titles and those who already had the hack working,
couldn’t edit the Template code anymore without switching back to the
normal title structure.


The Method


Below I’m outlining a very simple and 100% working way of having custom
titles in Blogger:


<b:if cond=data:blog.pageType == &quot;item&quot;>

<title><data:blog.pageName/> | <data:blog.title/></title>

<b:else/>

<title><data:blog.pageTitle/></title>

</b:if>


Copy and paste the above code replacing the <data:blog.pageTitle/>
line in your template code.


Or if you want the posts to have just the post title in the title tag and NO
blog name or if your blog name is too long, you may use the following code,
again replace <data:blog.pageTitle/> line with this code.


[Go to Layout->Edit HTML to place these codes.]


NOTE: Titles of pages are very critical when it comes
to Search Engines not just from SEO point of view but also from human perspective.
It’s a known fact that even if your website ranks higher but has irrelevant
(same looking titles) for all the pages, chances are peoples would rather click
on lower ranking pages having relevant titles.

Continue reading

Microsoft still supports Visual Basic

I recently received some email critical of my claim that Microsoft no longer supports or provides Visual Basic. I suppose this is a fair point. They do after all still sell a product called Visual Basic.

So what gives? An awful lot of people dont think that the new Visual Basic .Net product is Visual Basic at all. Its more of a version of C# (a Java clone, more or less) with some BASIC syntax thrown on top. Its not hard to use Google to find many articles of people who agree with this sentiment.

Here are some examples that I found in just minute:

http://www.sqlmag.com/articles/index.cfm?articleid=21050&

And from Wikipedia:
http://en.wikipedia.org/wiki/Visual_Basic_.NET#Comparative_samples
http://en.wikipedia.org/wiki/Visual_Basic_.NET#Controversy_concerning_VB.NET

If theres any dishonesty here, I claim that its on Microsofts part. For years people complained that Visual Basic isnt BASIC. Now people are complaining that VB.Net isnt Visual Basic. Where does it end? ;-)
Continue reading

Sunday, April 6, 2014

FIND PRIME NUMBER IN C

What is a PRIME NUMBER?
" A Natural number greater than 1 which has only two divisor 1 and itself is called prime number ".
For Example:  
5 is prime, because it has only two divisors 1 and itself.

C++ Program To Find Prime Numbers


  1. #include<iostream.h>
  2. #include<conio.h>
  3.         void main()
  4.         {
  5.          //clrscr();
  6.          int number,count=0;
  7. cout<<"ENTER NUMBER TO CHECK IT IS PRIME OR NOT ";
  8.           cin>>number;
  9.            for(int a=1;a<=number;a++)
  10.                {
  11.                 if(number%a==0)
  12.                    {
  13.                   count++;
  14.                    }
  15.                }
  16.        if(count==2)
  17.          {
  18.           cout<<" PRIME NUMBER
    ";
  19.          }
  20.        else
  21.          {
  22.           cout<<" NOT A PRIME NUMBER
    ";
  23.          }
  24.        //getch();
  25.        }



UNDERSTANDING PRIME NUMBERS PROGRAM LOGIC
  •      To make logic first think about PRIME NUMBER definition that a number which divides by 1 and itself.
  •    So we have make a condition like that in which user will enter a number and our program will check it by dividing it from 1 up to itself.
  •    To check that how much times it has divided to numbers from 1 to itself we take a variable and increment it each times when a number is divided.
  •    In C++ CODING we take a FOR LOOP which will start from 1 up to number that has entered to check whether it is PRIME NUMBER or not with in FOR LOOP we set an IF condition and placed counter (count++) variable in its body so whenever a number from 1 to number which has entered to check divides than IF condition becomes true and counter variable will be incremented.
  •    When FOR LOOP is completed we check from IF condition that if counter variables value is equal to 2 than number is PRIME else NUMBER IS NOT PRIME.
  •    Because if number divided two times by 1 and itself counter variable will incremented two times if more than two times counter variable will have value greater than 2. 
Prime number program image view
Find Prime Number in C++ Programming
C++ program to find prime numbers 
Sample Output:
C++ Programming prime number output sample

More programs

Find factorial of a number in C++
Find Fibonacci Series in C++
C++ Program to find last prime number before entered number 
Swap two variables with out using third variable 
Find binary value of decimal in C++
Find Palindrome Number in C++
Recommended: For fast learning change the logic and do experiment with codes.
Continue reading

PROGRAM TO FIND INTEGRAL VALUE USING SIMPSONS RULE

#define f(x) 1.0/(1+x*x)
main()
{
int n;
float simps(float,float,int)a,b;
printf("Enter the values of a,b and n
");

scanf("%f%f%d",&a,&b,&n);
printf("Integral value of f(x) by simpsons 1/3 rule:%f
",simps(a,b,n));

}

float simps(float a,float b,int n)
{
float x,y[21],h,sum;
int i;
h=(b-a)/n;
x=a;
for(i=0;i<=n;i++)
{
y[i]=f(x);
x=x+h;
}
sum=y[0]+y[n];
for(i=1;i<=n-1;i+=2)
sum+=4*y[i]+2*y[i+1];
sum-=2*y[n];
sum=sum*h/3.0;
return sum;
}

OUTPUT:
Enter the value of a,b and n
0     1     10
Integral value f(x) by simpsons 1/3 rule:0.785398
Continue reading

Saturday, April 5, 2014

Size of dataTypes

Q. Write a simple program to find the size of different basic data types in c?

Ans.


/*Program of shows of different data types size*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int i;
 char ch;
 float f;

 long l;
 double d; 

 long double ld;
 printf("
Size of different data types as following"
);
 printf("
"
);

 printf("
Size of character ch is %d"
,sizeof(ch));

 printf("
Size of integer is %d"
,sizeof(i)); 
 printf("
Size of float is %d"
,sizeof(f));

 printf("
Size of long is %d"
,sizeof(l));

 printf("
Size of double is %d"
,sizeof(d));

 printf("
Size of long double is %d"
,sizeof(ld));

 getch();
 return 0;
}

 Output of the above programs:

    Size of different data types

 Size of character ch is 1
 Size of integer is 2
 Size of float is 4
 Size of long is 4
 Size of double is 8
 Size of long double is 10

NOTE:-The size of int,long are compiler dependent. The above sizes in this program for 16-bit compiler.
Continue reading
 

Information Technology News Copyright © 2016 | Powered by Blogger