How To Find Greater Number Between two numbers In C


How To Find Greater Number Between two numbers

#include<stdio.h>

#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter two no");
scanf("%d%d",&a,&b);
if(a>b)
{
printf(" a is greater");
}
else
{
printf("b is greater");
}
getch();
}

How To Start Programming With C


when You Installed Turbo C and C++ after that you want to know how to start programming

Here I will tell you that
Open DosBox That Is On Your Desktop(As A shortcut of DosBox)
when It open Click On "File" after that on "new"
now you seen a blue page
click on it
write the first is headerfils
header files are
#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<graphics.h>
//etc..........
//after that you need to write any message but before that
//you need to write the main body so write
main()
{
//now you start your programme's body
//here you can write your msg
//for writing messege neet to put the command and the command is
//"printf" now see how can use this command
printf("My First C Programme");
getch();
}

now your programme is ready

see your fully programme that will show Your message"My First C Programme" is

#include<conio.h>
#include<stdio.h>
#include<math.h>
#include<graphics.h>
main()
{
printf("My First C Programme");
getch();
}

and most importent is this before run this save with .c name
like that myfirst.c of no1.c or myprog.c
but always have .c exetensen

Any More Info Click Any Other post
any Help Comment here

How To Make A marquee In C




#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_STR_LEN 40

typedef enum { false = 0, true } bool;
typedef enum { LEFT, RIGHT, LEFT_CIRCULAR, RIGHT_CIRCULAR } Direction;

void marquee(char *, size_t count, Direction);
void delay(int);
void shift(char *, size_t distance, Direction);
bool isCircularShift(Direction);
bool isAllSpaces(const char *);

char msg[MAX_STR_LEN];
const size_t repeatCount = 2;
const int delayCount = 1e6;
const int shiftLen = 1;

int main(int argc, char *argv[]) {

    while (1) {
        printf("> ");
        fgets(msg,MAX_STR_LEN,stdin);
        *(strchr(msg,'\n')) = '\0';
        marquee(msg, repeatCount, LEFT_CIRCULAR);
        marquee(msg, repeatCount, RIGHT_CIRCULAR);
    }
    return 0;
}

void marquee(char *s0, size_t count, Direction dir) {
    size_t len = strlen(s0) * 3, i, j;
    char *s;

    if (len > 0) {
        s = calloc(len+1,sizeof(char));
        memset(s, ' ', len);
        memcpy(s, s0, strlen(s0));

        /* Scroll it. */
        for (i = 0; i < count; i++) {
            for (j = 0; j < len; j++) {
                printf("\r%s",s); fflush(stdout);
                shift(s, shiftLen, dir);
                delay(delayCount);
            }
        }

        /* Clear it. */
        dir = (dir == RIGHT_CIRCULAR) ? RIGHT : LEFT;
        while (isAllSpaces(s) == false) {
            shift(s, shiftLen, dir);
            printf("\r%s",s); fflush(stdout);
            delay(delayCount);
        }
        printf("\r"); fflush(stdout);
        free(s);
    }
}

void shift(char *a, size_t distance, Direction dir) {
    char *source, *dest, *bumpFrom, *rotateTo, temp;
    size_t n, aLen = strlen(a);

    if (distance > 0) {
        if ((dir == RIGHT) || (dir == RIGHT_CIRCULAR)) {
            source = a; dest = a+1;
            bumpFrom = &a[aLen-1]; rotateTo = &a[0];
        } else {
            source = a+1; dest = a;
            bumpFrom = &a[0]; rotateTo = &a[aLen-1];
        }
        for (n = 0; n < distance; n++) {
            temp = *bumpFrom;
            memmove(dest,source,aLen-1);
            if (isCircularShift(dir) == true) {
                *rotateTo = temp;
            } else {
                *rotateTo = ' ';
            }
        }
    }
}

bool isCircularShift(Direction dir) {
    return (dir == LEFT_CIRCULAR) || (dir == RIGHT_CIRCULAR);
}

bool isAllSpaces(const char *s) {
    bool allSpaces = true;
    const char *p = s;

    while ((*p != '\0') && (allSpaces == true)) {
        allSpaces = (*p++ == ' ');
    }
    return allSpaces;
}

double factorial(unsigned n) {
    if (n == 1) return n;
    return n * factorial(n-1);
}

void delay(int n) {
    int i;

    for (i = 0; i < n; i++) {
        factorial(10);
    }
}

How to find even and odd number in C




#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter two no");
scanf("%d%d",&a,&b);
if(a%2==0)
{
printf("no is even no");
}
else
{
printf("no is odd no");
}
getch();
}

Set Text Color And Backgroung Of Any programme In C




#include<stdio.h>
#include<conio.h>
main()
{
int a;
clrscr();
{
textbackground(1);
textcolor(2);
cscanf("%d",&a);
if(a==1)
{
cprintf("sdf");
}
}
getch();
}

How to fine every type password thaty possiable by numeric values In C




#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c,d,e,f,g,h,i;
clrscr();
{
printf("Maybe passward are");
printf("\nminimam value");
scanf("%d",&a);
printf("\nMaxmim value");
scanf("%d",&b);
for(i=a;i<=b;i++)
{
for(h=a;h<=b;h++)
{
for(g=a;g<=b;g++)
{
for(f=a;f<=b;f++)
{
printf("\t%d%d%d%d",i,h,g,f);
}}}}}
getch();
}

How to find that given year is leap year or not in C




#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("enter the year");
scanf("%d",&year);
if(year%4==0)
{
printf("year is leap year");
}
else
{
printf("year is not year");
}
getch();
}

A Short C Program and A simple program Of C


This is a very simple program. All it does is input two numbers from the keyboard and calculate their product. At this stage, don't worry about understanding the details of the program's workings. The point is to gain some familiarity with the parts of a C program so that you can better understand the listings presented later in this book.
Before looking at the sample program, you need to know what a function is, because functions are central to C programming. A function is an independent section of program code that performs a certain task and has been assigned a name. By referencing a function's name, your program can execute the code in the function. The program also can send information, called arguments, to the function, and the function can return information to the main part of the program. The two types of C functions are library functions, which are a part of the C compiler package, and user-defined functions, which you, the programmer, create.



1:  /* Program to calculate the product of two numbers. */
2:  #include <stdio.h>
3:
4:  int a,b,c;
5:
6:  int product(int x, int y);
7:
8:  main()
9:  {
10:     /* Input the first number */
11:     printf("Enter a number between 1 and 100: ");
12:     scanf("%d", &a);
13:
14:     /* Input the second number */
15:     printf("Enter another number between 1 and 100: ");
16:     scanf("%d", &b);
17:
18:     /* Calculate and display the product */
19:     c = product(a, b);
20:     printf ("%d times %d = %d\n", a, b, c);
21:
22:     return 0;
23: }
24:
25: /* Function returns the product of its two arguments */
26: int product(int x, int y)
27: {
28:     return (x * y);
29: }



Enter a number between 1 and 100: 35
Enter another number between 1 and 100: 23
35 times 23 = 805

Preparing to Program OF C


You should take certain steps when you're solving a problem. First, you must define the problem. If you don't know what the problem is, you can't find a solution! Once you know what the problem is, you can devise a plan to fix it. Once you have a plan, you can usually implement it. Once the plan is implemented, you must test the results to see whether the problem is solved. This same logic can be applied to many other areas, including programming.

When creating a program in C (or for that matter, a computer program in any language), you should follow a similar sequence of steps:
1. Determine the objective(s) of the program.
2. Determine the methods you want to use in writing the program.
3. Create the program to solve the problem.
4. Run the program to see the results.
An example of an objective (see step 1) might be to write a word processor or database program. A much simpler objective is to display your name on the screen. If you didn't have an objective, you wouldn't be writing a program, so you already have the first step done.
The second step is to determine the method you want to use to write the program. Do you need a computer program to solve the problem? What information needs to be tracked? What formulas will be used? During this step, you should try to determine what you need to know and in what order the solution should be implemented.
As an example, assume that someone asks you to write a program to determine the area inside a circle. Step 1 is complete, because you know your objective: determine the area inside a circle. Step 2 is to determine what you need to know to ascertain the area. In this example, assume that the user of the program will provide the radius of the circle. Knowing this, you can apply the formula pr2 to obtain the answer. Now you have the pieces you need, so you can continue to steps 3 and 4, which are called the Program Development Cycle.

Why Use C????


Why Use C?






In today's world of computer programming, there are many high-level languages to choose from, such as C, Pascal, BASIC, and Java. These are all excellent languages suited for most programming tasks. Even so, there are several reasons why many computer professionals feel that C is at the top of the list:









  • C is a powerful and flexible language. What you can accomplish with C is limited only by your imagination. The language itself places no constraints on you. C is used for projects as diverse as operating systems, word processors, graphics, spreadsheets, and even compilers for other languages.
  • C is a popular language preferred by professional programmers. As a result, a wide variety of C compilers and helpful accessories are available.
  • C is a portable language. Portable means that a C program written for one computer system (an IBM PC, for example) can be compiled and run on another system (a DEC VAX system, perhaps) with little or no modification. Portability is enhanced by the ANSI standard for C, the set of rules for C compilers.
  • C is a language of few words, containing only a handful of terms, called keywords, which serve as the base on which the language's functionality is built. You might think that a language with more keywords (sometimes called reserved words) would be more powerful. This isn't true. As you program with C, you will find that it can be programmed to do any task.
  • C is modular. C code can (and should) be written in routines called functions. These functions can be reused in other applications or programs. By passing pieces of information to the functions, you can create useful, reusable code.


As these features show, C is an excellent choice for your first programming language. What about C++? You might have heard about C++ and the programming technique called object-oriented programming. Perhaps you're wondering what the differences are between C and C++ and whether you should be teaching yourself C++ instead of C.
Not to worry! C++ is a superset of C, which means that C++ contains everything C does, plus new additions for object-oriented programming. If you do go on to learn C++, almost everything you learn about C will still apply to the C++ superset. In learning C, you are not only learning one of today's most powerful and popular programming languages, but you are also preparing yourself for object-oriented programming.
Another language that has gotten lots of attention is Java. Java, like C++, is based on C. If later you decide to learn Java, you will find that almost everything you learned about C can be applied.

A Brief History of the C Language


You might be wondering about the origin of the C language and where it got its name.
C was created by Dennis Ritchie at the Bell Telephone Laboratories in 1972.
The language wasn't created for the fun of it, but for a specific purpose: to design the
 UNIX operating system (which is used on many computers). From the beginning,
C was intended to be useful--to allow busy programmers to get things done.

Because C is such a powerful and flexible language, its use quickly spread beyond
 Bell Labs. Programmers everywhere began using it to write all sorts of programs.
Soon, however, different organizations began utilizing their own versions of C, and
subtle differences between implementations started to cause programmers headaches.
 In response to this problem, the American National Standards Institute (ANSI) formed
 a committee in 1983 to establish a standard definition of C, which became known as
ANSI Standard C. With few exceptions, every modern C compiler has the ability to
adhere to this standard.



Now, what about the name? The C language is so named because its
 predecessor was called B. The B language was developed by Ken Thompson of Bell Labs.
 You should be able to guess why it was called B.

Why Use C?

In today's world of computer programming, there are many high-level languages to choose from, such as C, Pascal, BASIC, and Java. These are all excellent languages suited for most programming tasks. Even so, there are several reasons why many computer professionals feel that C is at the top of the list:
  • C is a powerful and flexible language. What you can accomplish with C is limited only by your imagination. The language itself places no constraints on you. C is used for projects as diverse as operating systems, word processors, graphics, spreadsheets, and even compilers for other languages.
  • C is a popular language preferred by professional programmers. As a result, a wide variety of C compilers and helpful accessories are available.
  • C is a portable language. Portable means that a C program written for one computer system (an IBM PC, for example) can be compiled and run on another system (a DEC VAX system, perhaps) with little or no modification. Portability is enhanced by the ANSI standard for C, the set of rules for C compilers.
  • C is a language of few words, containing only a handful of terms, called keywords, which serve as the base on which the language's functionality is built. You might think that a language with more keywords (sometimes called reserved words) would be more powerful. This isn't true. As you program with C, you will find that it can be programmed to do any task.
  • C is modular. C code can (and should) be written in routines called functions. These functions can be reused in other applications or programs. By passing pieces of information to the functions, you can create useful, reusable code.


As these features show, C is an excellent choice for your first programming language. What about C++? You might have heard about C++ and the programming technique called object-oriented programming. Perhaps you're wondering what the differences are between C and C++ and whether you should be teaching yourself C++ instead of C.
Not to worry! C++ is a superset of C, which means that C++ contains everything C does, plus new additions for object-oriented programming. If you do go on to learn C++, almost everything you learn about C will still apply to the C++ superset. In learning C, you are not only learning one of today's most powerful and popular programming languages, but you are also preparing yourself for object-oriented programming.
Another language that has gotten lots of attention is Java. Java, like C++, is based on C. If later you decide to learn Java, you will find that almost everything you learned about C can be applied.