welcome to c
Introduction to C Programming C language was developed by Dennis Ritchi…

Reverse String in C programming

Add caption Reverse String in C  :- The Purpose of Reverse String in C is …
GETTING STARTED WITH PYTHON PROGRAMMING. Python is a high-level, interpret…
welcome to c

Introduction to C Programming


  • C language was developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell Laboratories.
  • Most of the features in C are derived from "B" programming language.  That is the reason why the new language was named as "C".
  • C is a high level language but it lacks features like garbage collection, object orientation which are usually available in high-level languages.
  • C is a structured programming language.  Because, C provides many features like functions, if statements, loops, blocks etc.
  • Most part of the UNIX operating system was written in C
  •  C was initially designed to develop system software.  Because of its simplicity, flexibility and portability, it is also used to develop application software. 

Applications of C programming language:
  • Used to develop firmware for micro controllers, operating system, device drivers etc.
  • Major programming languages like PHP, Perl , Python etc. are written in C
  • Used to develop application softwares like media player, mp3 player, games etc.

C Programming- A program that calculates and displays the price before commission and after commission of 6%: The program prompt the user to enter



 A program that calculates and displays the price before commission
 and after commission of 6%: The program prompt the user to enter
i. Quality of products purchased
ii. Unit price.

Complied On : Code::Blocks 17.0

Save :- .c file (C Program)

Created By :- Lukas Yooma 


                                                                                                                                                               
#include <stdio.h>

int quantity, price, b4;
float commision;

main()
{
    printf("\nENTER THE QUANTITY OF THE PRODUCTS PURCHASED ?\n");
    scanf("%d", &quantity);

    printf("WHAT IS THE UNIT PRICE \n");
    scanf("%d", &price);

    b4=(quantity*price);

    printf(" THE PRICE BEFORE COMMISION %d\n",b4);

    commision=(b4-0.06*b4);

    printf("\nTHE PRICE AFTER THE COMMISION OF 6 PERCENT %f\n",commision);

    main(0);

}
                                                                                                                               
Thank you For reading please leave your comments for any queries 




PROGRAMMING IN C- A function which outputs all the prime numbers between 2 and a given positive integer n:



This program will allow users to find the the prime numbers between 2 and a given positive integer 


Complied On : Code::Blocks 17.0

Save :- .c file (C Program)

Created By :- Lukas Yooma 
Find the code below
                                                                                                                                                                   

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

int main()
{
    int i,j, n=0,prime;

    printf("PLEASE ENTER THE NUMBER TO FIND ITS PRIME NUMBERS :\t");
    scanf("%d", &prime);
    for(i = 2; i <=prime; i++)
    {
        for (j=1; j<= i; j++)
        {
            if (i%j == 0)
            {
                n++;
            }
        }
        if (n == 2)
    printf("%d\n", i);
    n=0;
    }
    getchar();

    main();
}
                                                                                                                                                                
Thanks for reading, leave a comment for any queries
                                                                                                       

Programming in C - A program which inputs a person’s height (in centimeters) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria:






A program which inputs a person’s height (in centimeters) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria:
              Underweight:    weight < height/2.5
              Normal:             height/2.5 <= weight <= height/2.3

              Overweight:      height/2.3 < weight


Complied On : Code::Blocks 17.0

Save :- .c file (C Program)

Created By :- Lukas Yooma 
Below is the code 
                                                                                                                                            
#include <stdio.h>
#include <stdlib.h>

int main()
{
    float height, weight;

    printf("\nENTER YOUR HEIGHT IN CENTMETERS \n");
    scanf("%lf",&height);
    printf("\nENTER YOUR WEIGHT IN KILOGRAMMES \n");
    scanf("%lf", &weight);

    if(weight < height/2.5)
    printf("YOU ARE UNDERWEIGHT \n");
    else


    if(height/2.3 < weight)
    printf("YOU ARE OVERWEIGHT \n");
    else


    if(height/2.5 <= weight <= height/2.3)
    printf("YOU ARE NORMAL\n");


    main(0);
}
                                                                                                                                                                   
Thanks for reading leave a comment for any queries

Reverse String in C programming


Add caption
Reverse String in C  :-
The Purpose of Reverse String in C is to reverse sentences from the end to 
the beginning 



Complied On : Code::Blocks 17.05

Save :- .c file (C Program)

Created By :- Luka Yooma 


Below Is the code for the Reverse String



/**
 * C program to reverse order of words in a string
 */
#include <stdio.h>
#include <string.h>
#define MAX_SIZE 100 // Maximum string size

int main()
{
    char str[100], reverse[100];
    int len, i, index, wordStart, wordEnd;

    printf("Enter any sentence:\n\t ");
    gets(str);

    len   = strlen(str);
    index = 0;

    // Start checking of words from the end of string
    wordStart = len - 1;
    wordEnd   = len - 1;

    while(wordStart > 0)
    {



        // If a word is found
        if(str[wordStart] == ' ')
        {
            // Add the word to the reverse string
            i = wordStart + 1;
            while(i <= wordEnd)
            {
                reverse[index] = str[i];

                i++;
                index++;
            }
            reverse[index++] = ' ';

            wordEnd = wordStart - 1;
        }

        wordStart--;
    }

    // Finally add the last word
    for(i=0; i<=wordEnd; i++)
    {
        reverse[index] = str[i];
        index++;
    }

    // Add NULL character at the end of reverse string
    reverse[index] = '\0';

    printf("Original sentence \n%s\n\n", str);
    printf("Reversed Sentence \n%s", reverse);

    return 0;

}




Thanks to all my Readers Leave a comment for any queries.......

GETTING STARTED WITH PYTHON PROGRAMMING.

Image result for Python
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.
  • Python is Interpreted − Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
  • Python is Interactive − You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
  • Python is Object-Oriented − Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
  • Python is a Beginner's Language − Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.

History of Python

Python was developed by Guido van Rossum in the late eighties and early nineties at the National Research Institute for Mathematics and Computer Science in the Netherlands.
Python is derived from many other languages, including ABC, Modula-3, C, C++, Algol-68, SmallTalk, and Unix shell and other scripting languages.
Python is copyrighted. Like Perl, Python source code is now available under the GNU General Public License (GPL).
Python is now maintained by a core development team at the institute, although Guido van Rossum still holds a vital role in directing its progress.

Python Features

Python's features include −
  • Easy-to-learn − Python has few keywords, simple structure, and a clearly defined syntax. This allows the student to pick up the language quickly.
  • Easy-to-read − Python code is more clearly defined and visible to the eyes.
  • Easy-to-maintain − Python's source code is fairly easy-to-maintain.
  • A broad standard library − Python's bulk of the library is very portable and cross-platform compatible on UNIX, Windows, and Macintosh.
  • Interactive Mode − Python has support for an interactive mode which allows interactive testing and debugging of snippets of code.
  • Portable − Python can run on a wide variety of hardware platforms and has the same interface on all platforms.
  • Extendable − You can add low-level modules to the Python interpreter. These modules enable programmers to add to or customize their tools to be more efficient.
  • Databases − Python provides interfaces to all major commercial databases.
  • GUI Programming − Python supports GUI applications that can be created and ported to many system calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window system of Unix.
  • Scalable − Python provides a better structure and support for large programs than shell scripting.
Apart from the above-mentioned features, Python has a big list of good features, few are listed below −
  • It supports functional and structured programming methods as well as OOP.
  • It can be used as a scripting language or can be compiled to byte-code for building large applications.
  • It provides very high-level dynamic data types and supports dynamic type checking.
  • IT supports automatic garbage collection.
  • It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java.