Shonu Tech

Business, Digital Marketing, SEO, Technology, Programming Languages, Computer

Home Advertisement Full Widh

Post Page Advertisement [Top]

C Programming Language


1. GUI (Windows family) = Graphical user interface.
2. CUI = Character user interface.

                                   DOS (Disk operating system) (Linux family)
learn c programming language online,learn c programming language online free,how to learn c programming language online,c programming,learn c programming,c programming language,c (programming language),c programming for beginners,programming in c,c programming tutorial,learn c language,programming,learn programming,c programming hindi,c programming course,c programming basics,learn c++ programming,programming language (software genre),c++ programming,how to learn programming,learn c,the c programming language,c programming language tutorial,c programming language tutorial for beginners,learn c# programming
Programming Level:-
1. Low level → Binary language.
2. Middle level.
3. High level → English.

Assembler is a software which uses to convert 0 and 1.
Software which convert the high level programming language to low level programming language.

1. Code Blocks  
2. Turbo C++   
             ⇓
This two software's are used to run C or C++.

History of C:-
 The "C" programming language is a structure oriented programming language, developed at the bell laboratories in 1972 by father of c programming language Denis Ritchic.
 "C" programming language feature were derived from an earlier language called "B" (Basic combined programming language - BCPL)
 "C" language was invented for implementing UNIX operating system.
 In 1978, Denis Ritchic and Brain Kenighan published the first edition.
"The c programming language" and commonly known as K & RC.
 In 1983, the American National Standards Institute (ANSI) established a committee to provide a modern, comprehensive defination of c. the resulting definition, the ANSI standard, or "ANSIC", was completed late 1988.

1. Data type:- Data types are keywords which is used to represent type of data.
Integers has 2 or 4 bytes.
Character has 1 bytes.
Float has 4 bytes.
Double has 8 bytes.
Sort has 2 bytes, if you want to reduce the size.
long has 4 bytes, if you want to increase the size.

Function:-
Syntax:-
return_type f_name()
{

}

 Print f ( ) = "Print F" is predefined function, which is used to print output statement on output screen.
 Scan f ( ) = "Scan F" is a predefined function which is used to read data from keyboard.
 If we want to print integer values then we use %d.
 If we want to print float values then we use %f.
 If we want to print double values the we use %1f.
 If we want to print char values then we use %c.
 Char values is nothing but Character values.

Example:-
#include<stdio.h>
void main()
{
int a=90;
float b=89.7;
double c=67.4;
char d='a';
Printf("%d",a);
Printf("%f",b);
Printf("%1f",c);
Printf("%c",d);
return 0;
}
_________________________________________________________________________________
In the same program if we want to get output in next line.
then, in the place of this,
Printf("%d",a);
Printf("%f",b);
Printf("%1f",c);
Printf("%c",d);

we should put \n as below

Printf("%d\n",a);
Printf("%f"\n,b);
Printf("%1f\n",c);
Printf("%c\n",d);

we can also write it as,

Printf("integer value is %d\n",a);
Printf("float value is %f"\n,b);
Printf("double value is %1f\n",c);
Printf("character value is %c\n",d);
_________________________________________________________________________________
Uses of "C" programming language:-
The "C" programming language is used for developing system applications that form a major portion of operating systems such as Windows, Unix, and Linux. Below are some examples of "c" being used.

1. Database systems = database is an organized collection of data, generally stored and accessed electronically from a computer system. ... The database management system (DBMS) is the software that interacts with end users, applications, and the database itself to capture and analyze the data.

2. Graphics packages = graphics package is an application that can be used to create and manipulate images on a computer. There are two main types of graphics package: painting packages. drawing packages.

3. Word processors = word processor is software or a device that allows users to create, edit, and print documents. It enables you to write text, store it electronically, display it on a screen, modify it by entering commands and characters from the keyboard, and print it. Of all computer applications, word processing is the most common.

4. Operating system development = Operating systems can be a very complex topic. Learning how operating systems work can be a great learning experience.
The purpose of this series is to teach the black art of Operating System (OS) Development, from the ground up. Whether you want to make your own OS, or simply to learn how they work, this series is for you.


5. Compilers and assemblers = A program which translates an assembly language program into a machine language program is called an assembler. ... Compiler: It is a program which translates a high level language program into a machine language program. Acompiler is more intelligent than an assembler.

6. Network drivers = As a PC user at some point, you have heard of Network Drivers. Have you ever wondered what network drivers is all about? Prior to figuring out what a network driver is, let us get to know few things about something called Network Adapter.
A device needs to be connected to a network for you to access the internet and that’s where network adapter comes in.

7. Interpreters = It involves translation of a document from one language into another. There are different kinds of translations: general, technical, medical, legal etc. The best translation is the one that when someone reads the document he/she believes it is the original document it was written in and not a translation of it. In other words it is not literally but it flows and makes sense to the reader as if it were the original document itself.
It involves interpreting what a person says from one language into another. There are different types of interpreting modes such as

"C" language is structured language.

1. "c" programming basics to write a "c" program.
"C" basic commands.                                           Explanation.
#include <stdio.h> This is a pre-proccessor command that includes standard input output leader file (stdio.h) from the c library before compiling a c program.

Void main( ) This is the main function from where execution of any c program begins.
{ = This indicates the beginning of the main function.
} = This indicates the ending of the main function.
printf ("Hello, world:"); printf command prints the output onto the screen.

 printf ( ) function in c programming language:-
         In c programming language , printf ( ) function is used to print the "character, string, float, integer values" onto the screen.
         we use printf ( ) function with %d format specifier to display the value of am integer variable.
         similarly %c is used to display character, %f for float variable, %s for string variable, 1f for double variable.
         to generate a newline, we use "\n" in c printf ( ) statement.
note:- C langauage is case sensitive for example, printf ( ) and scanf ( ) are different from printf ( ) and scanf (). all charecters in printf ( ) and scanf ( ) functions must be in lower case.

key words in c language:- Keywords are pre-defined words in a c compiler. Each keywords is meant to perform a specific function in a c program since, keywords are referred names for compiler , they can`t be used a variable name. c language supports 32 keywords which are given below.
1. Auto
2. Double
3. int
4. struct
5. const
6. float
7. short
8. unsigned
9. break
10. else
11. long
12. switch
13. continue
14. for
15. signed
16. void
17. enum
18. register
19. typedef
20. default
21. goto
22. size of
23. volatile
24. char
25. extern
26. return
27. union
28. do
29. if
30. static
31. while
32. case

Operand:- 2+4  =6
                   ↘↙
               operand

operator:- t - = etc.,

Naming conventions for variables:-
1. we should not take variables as variable name.
int int = 90;
2. We should not take numbers as variables.
3. Variables name starts from alphabets (small letters are recommended) we can take capital letters also.
4. Variables can starts with under-score ( _ ) or doller ( $ ).
5. variable names does not allow white spaces.

Examples:-
1. Write a program to print student name, work, address.

#include <stdio.h>
void main ( )
{
char name [10]="ravi";
int marks = 90;
char address [10]="hyderabad";
printf ("name is %s\n,name");
printf ("marks : is %d\n,marks");
printf ("address is %s\n,address");
}

2. write a program to take int value, float value, double value, char value and string value from user and print in output screen.

#include<stdio.h>
void main ( )
{
int a;
float b;
double c;
char d;
char e [10];
printf("enter your character");
scanf("%c",& d);
printf("enter your integer value");
scanf("%d",& a);
printf("enter your integer value");
scanf("%f",& c);
printf("enter your integer value");
scanf("%lf",& d);
printf("enter your integer value");
scanf("%ds",& e);
}

LBPS:- 
Logical building effective problem solving.

Money transaction in ATM:- 
1. insert ATM card
2. select the language
3. select the card type
4. enter amount
5. enter pincode
6. stop




1. start program
2. take value
3. check the value is greater then '0'
4. if true +ve
5. if false, check a<0.
6. if true -ve
7. if false zero
8. stop all.
_________________________________________________________________________________
Draw a flow chart to print eligibility of voting of a given age.




1. start program.
2. take a value from user.
3. check if it is true then eligible.
4. check if it is false then not eligible.
5. stop.
_________________________________________________________________________________
Draw a flow chart to check the given number is even or odd numbers.



_________________________________________________________________________________
1. write a program to read character from user and check that is character or not.

#include<stdio.h>
void main ( )
{
char c;
printf("enter your character");
scanf("%c",&c);
if (c<'z' && c>='a')
{
printf("alphabet");
}
else
{
printf("no it is not alphabet");
}
}

Athinetic operator
+,- ,*,/,%

relational operator
<, < = >, > =, = <, ! =
a > b
a > = b
a ! = b
a < b
a < = b
a ! = b

logical operator
&& → and.
_________________________________________________________________________________
2. write a program to check the given character is alphabet or digit or special character.

#include <stdio.h>
void main ( )
{
char c;
printf("enter your character");
scanf("%c",&c);
if (c<='z' && c>='a'||c<='Z' && c>='A');
{
printf("alphabet");
}
else if (c<='a' && c>='z')
{
printf("digit");
}
else
{
prinf("special character");
}
}
_________________________________________________________________________________
write a program to check the given character is uppercase letter or lower case letter.

#include<stdio.h>
void main ( )
{
char c;
printf("enter your character");
scanf("%c",&c);
if (c<='z' && c>='a')
{
printf("lower case lettter");
}
else if (c<='Z' && c>='A')
{
printf("upper case letter");
}
else
{
printf("enter number is not alphabet");
}
}
_________________________________________________________________________________
write a program to print largest number of given 3 numbers

#include<stdio.h>
void main( )
{
int a=0, b=0, c=0;
printf("enter your first value");
scanf("%d",&a);
printf("enter your second value");
scanf("%d",&b);
printf("enter your third value");
scanf("%d",&c);
if (a>b && a>c)
{
printf("%d is largest number",a);
}
else if (b>a && b>c)
{
printf("%d is largest number",b);
}
else
{
printf("%d is largest number",c);
}
}
_________________________________________________________________________________
write a program to input marks of five subjects physics, chemistry, biology, mathematics and computer calculate percentage and grade according to following
percentage > = 90%: grade A
percentage > = 80%: grade B
percentage > = 70%: grade C
percentage > = 60%: grade D
percentage < = 60%: fail.

#include<stdio.h>
void main( )
{
int physics=0, chemistry=0, biology=0, mathematics=0, computer=0, total=0, avg=0;
printf("enter your physics marks = ");
scanf("%d",&physics);
printf("enter your chemistry marks = ");
scanf("%d",&chemistry);
printf("enter your biology marks = ");
scanf("%d",&biology);
printf("enter your mathematics marks = ");
scanf("%d",&mathematics);
printf("enter your computer marks = ");
scanf("%d",&computer);
total = physics+chemistry+biology+mathematics+computer;
avg = total/5;
if(avg>=90)
{
printf("grade A");
}
else if (avg >= 80 && avg <90)
{
printf("grade B");
}
else if (avg >= 70 && avg <80)
{
printf("grade C");
}
else if (avg >= 60 && avg <60)
{
printf("grade D");
}
else if (avg < 60);
{
printf("fail");
}
}
_________________________________________________________________________________
write a program to input basic salary of an employee and calculate its gross salary according to following
Basic salary < = 10000: HRA = 20%, DA = 80%
Basic salary < = 20000: HRA = 25%, DA = 90%
Basic salary < = 20000: HRA = 30%, DA = 95%

Gross salary = basic salary + HRA + DA;


#include<stdio.h>
void main( )
{
float bsalary=0.0, hra=0.0, da=0.0, gsalary=0.0;
printf("enter your basic salary");
scanf("%f", & bsalary);
if (bsalary <= 10000)
{
hra = (bsalary*20)/100;
da = (bsalary*80)/100;
gsalary=bsalary+hra+da;
printf("gross slary is %f",gsalary);
}
else if (bsalary <= 20000 && bsalary>10000)
{
hra=(bsalary*25)/100;
da=(bsalary*90)/100;
gsalary=bsalary+hra+da;
printf("gross salary is %f",gsalary);
}
else if (bsalary > 20000)
{
hra=(bsalary*30)/100;
da=(bsalary*95)/100;
gsalary=bsalary+hra+da;
printf("gross salary is %f",gsalary);
}
}
_________________________________________________________________________________
write a program to input electricity unit charges and calculate total electricity bill according to the given condition
for first 50 units                 rs. 0.50% unit.
for next 100 units               rs. 0.75% unit.
for next 100 units               rs. 1.25% unit.
for unit above 250              rs. 1.50% unit.
an additional surcharges of 20% is added to the bill.

#include<stdio.h>
void main( )

{

float unit=0, bill=0;

printf("enter number of units");

scanf("%f",&unit);

if (unit<=50)

{

bill=unit*0.50;

}

else if (unit>50 && unit<=150)

{

bill=(50*0.50)+(unit-50)*0.75;

}

else if (unit>150 && unit<=250)

{

bill=(50*0.50)+(100*0.75)+(unit-150)*1.20;

}

else if (unit>250)

{

bill=(50*0.50)+(100*0.75)+(100*1.20)+(unit-250)*1.50;

}

bill=bill+(bill*20)/100;

printf("final bill is %f",bill);

}
_________________________________________________________________________________
write a program to print notes of a given amount
1000
500
100
50
20
10
5
2
1

#include <stdio.h>

void main( )

{

int a=0, b=0, c=0, d=0, e=0, f=0, g=0, h=0, i=0, amount=0;

printf("enter your amount");

scanf("%d",&amount);

if (amount>=1000)

{

a=amount/1000;

amount=amount-(1000*a);

}

if (amount>=500)

{

b=amount/500;

amount=amount-(500*b);

}

if (amount>=100)

{

c=amount/100;

amount=amount-(100*c);

}

if (amount>=50);

{

d=amount/50;

amount=amount-(50*d);

}

if (amount>=20);

{

e=amount/20;

amount=amount-(20*e);

}

if (amount>=10);

{

f=amount/10;

amount=amount-(10*f);

}

if (amount>=5);

{

g=amount/5;

amount=amount-(5*g);

}

if (amount>=2);

{

h=amount/2;

amount=amount-(2*h);

}

if (amount>=1);

{

i=amount/1;

amount=amount-(1*i);

}

}
_________________________________________________________________________________
write a program to print table of a given number

#include<stdio.h>

void main( )

{

int i=0,n=0;

printf("enter your n number = ");

scanf("%d",&n);

for (i=1; 1<=10; i++)

{

printf("%d*%d=%d\n",n,i,n*i);

}

}
_________________________________________________________________________________
write a program to print first 10 even numbers

#include<stdio.h>

void main( )

{

int i=0;

for (i=1; i<=20; i++)

{

if (1%2==o)

{

printf("%d\t",i);

}

}

}
_________________________________________________________________________________
write a program to print n to 1 number

#include<stdio.h>
void main( )
{
int i=0, n=0;
printf("enter your n number = ");
scanf("%d",&n);
for (i=n; i>=1; i--)
{
printf("%d\t",i);
}
}
_________________________________________________________________________________

write a program to take 2 integer values and print between values

#include<stdio.h>
void main ( )
{
int i=0, first=0, last=0;
printf("enter your first value");
scanf("%d",&first);
printf("enter your last value");
scanf("%d",&last);
if (first<last)
{
for (i=first; i<=last; i++)
{
printf("%d\t", i);
}
}
else
{
for (i=first; i>=last; i--)
{
printf("%d\t",i);
}
}
}
_________________________________________________________________________________
write a program to print sum of first 10 numbers

#include<stdio.h>
void main( )
{
int i=0, sum=0;
for (i=1; i<=10; i++)
{
sum=sum+i;
}
printf("sum is %d", sum);
}
_________________________________________________________________________________
write a program to print sum of first 10 odd numbers sum

#include<stdio.h>
void main( )
{
int i=0, sum=0;
for (i=1; i<=20; i++)
{
if (i%2!=0)
{
(sum=sum+i);
}
}
printf("sum is %d",sum);
}
_________________________________________________________________________________
write a program to print first 10 numbers

#include <stdio.h>
void main( )
{
int i=0, a=0, b=1, sum=0;
printf("%d %d",a,b);
for (i=1; i<=10; i++)
{
a=b;
b=sum;
sum=a+b;
printf("%d\t",sum);
}
}
_________________________________________________________________________________
while (condition)

#include<stdio.h>
void main( )
{
int i=0;
while (i<=10)
{
printf("%d\n",i);
i++;
}
}
_________________________________________________________________________________
write a program to print number of digits in a given number

#include<stdio.h>
void main()
{
int i=0, rem=0, count=0;
printf("enter your value = ");
scanf("%d",&i);
while (i>0)
{
rem=i%10;
i=i/10;
count++;
}
printf("%d",count);
}
_________________________________________________________________________________
loop:-
do while:-

int i=0;
do
{
printf("hai");
i++;
}
while(i<=10);
_________________________________________________________________________________
write a program to print 1 to 10 even numbers by using do while loop

#include<stdio.h>
void main()
{
    int i=1;
    do
    {
        if(i%2==0)
        {
            printf("%d\n",i);
        }
        i++;
    }
    while(i<=20);
}
__________________________________________________________________________________

switch case:
syntax:-

switch (value)
{
case 1:
{
statement;
}
default:
}
statement;
}
___________________________________________________________________________________
switch case:-
syntax:

switch (value)
{
case 1:
{
statement;
}
case 2:
{
statement;
}
case 3:
{
statement;
}
case n:
{
statement;
}
default:
{
statement;
}
}
___________________________________________________________________________________
write a program to show the day number by using switch case

#include<stdio.h>
void main()
{
    int value=0;
    printf("enter your value");
    scanf("%d",& value);
    switch (value)
    {
        case 1:
            {
                printf("Sunday");
                break;
            }
            case 2:
            {
                printf("Monday");
                break;
            }
            default:
                {
                    printf("invalid entry");
                }
    }
}


1 comment:

  1. If you are currently scared of your reports, it means your company has not been able to find the right tool to help display a condensed view of performance information. https://www.inetsoft.com

    ReplyDelete

Bottom Ad [Post Page]