Search This Blog

Sunday, March 22, 2020

Spyn number [C programming]

Mr. abhijeet dwivedi

                                    C-Programming:-

In this tutorial yon will learn:-

 

Write a program to check whether a number spy or not.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,sum=0,product=1,r;
printf("Enter any number");
scanf("%d",&n);
while(n>0)
{
r=n%10;
sum=sum+r;
product=product*r;
n=n/10;
}
if(sum=product)
{
printf("number is spy");
}
else
{
printf("number is not spy");
}
getch();
}

Pallindrome number [C programming]

Mr. abhijeet dwivedi

                                       C-Programming:-

In this tutorial, you will learn:-

 

1) Write a program to check whether a number is pallindrome or not.

 #include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0 
 printf("enter any number");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
sum=sum*10+r;
n=n%10;
}
if(temp=sum)
{
printf("number is pallindrome");
}
else
{
printf("number is not pallindrome");
}
getch();
}

Armstrong number [ C- Programming]

Mr. abhijeet dwivedi

                                     C-Programming:-

In this tutorials, you will learn

 

1) Write a progrm to check whether a number is armstrong or not.

#include<stdio.h>
#include<conio.h>
void main()
{
int n,r,sum=0,temp,c;
printf("enter any no");
scanf("%d",&n);
temp=n;
while(n>0)
{
r=n%10;
c=r*r*r;
sum=sum+c;
n=n/10;
}
if(n=sum)
{
printf("number is armstrong ");
}
else
{
printf("number is not armstrong");
}
getch();
}

Some basic terms and important definition in C-Programming

Mr. abhijeet dwivedi

                                        C-Programming:-

In this tutorials, you will learn-

 


* getch() :-  getch(); is a non standard function and is present in < conio.h > . It hold the output window ,till the user feed input or press any key from the keyboard.  (input a number on keyboard to get back to your program )

*getche() :-  getche (); this is a non standard function which is present in <conio.h>  . It reads the single charcter from the keyboard and display immediately on output screen without waiting for enter key.

* getchar() :-  getchar(); is the function which is used to get/read a character from keyboard input. We can use getchar function as    --        getch(char);

* gets() :-   The gets(); function is used to scan or read a line of text from a standard input devices  and store it in the string variable . when it read the new line character then gets function will be terminated .

putch() :-  putch(); display the any alpha numeric character to the standard output devices.It display only one character at a time.

* puts() :-  puts function is a file handling function in C programming language which is used to write a line to the output screen .

* putche() :-  Like putch this function display a character on the screen but with echo on . 6.

*putchar() :-   putchar function is  a file handling function in C programming language which is used to write character on standard output/screen

*Void main() :- Void main () indicates the main () function will not return any value , and it is a user define function.

*Main function :- The mai  function is the entry point of any C program. This contains two part declaration part & executable part.

*Operating system :- It is a inter phase  or bridge between user and computer  or  between hardware and software

*Compiler :- The compiler converts source code into machine code at one.

*Interpreter :- The interpreter converts source code into machine code line by line.

*Headerfile :- The collection of pre define function which is already exists in library.

*Gobal variable :- The global variable that can be use anywhere in the program.

*Local variable :- The variable which is use for local scope , within the block {.....}

*Operators :- The operator are sign which is use for generate and an expression.

*Documentation section :- The documentation section consist of a set of comment line giving the name of program and other details.

*Comments :-A comments is an explanation or description of the source code of the program. It helps a developers explains logic which of the codes and improve program readability . At run time compiler ignores comments.

*Character sets :- A character sets in C programming is sets of all valid character that can be used to form words ,numbers,and expression in source program.

*Array :- Array is the collection is of homogeneous data items that share a common name . Array contains similar kind of value on a same name it allocate contiguous and sequential memory . Array have some many other things which we discuss our next post.

*String :- A group of character is called string . string have also many types and many other function which we discuss on my next blog..

 


Thursday, March 19, 2020

c programming storage class | codeswithabhi

Mr. abhijeet dwivedi

C programming storage class

In this tutorials, you will learn:-

 Storage Classes:-

 


Storage class is  define the scope (visibility) life time of variable or function with in the program.

C programming has four types of storage classes:-

1  Auto          (all local values)

2  Extern       (all global variable)

3  Static         (local variables)

4  Register    (fast accessing memory)

Auto :-   Auto is the deafult storage class for all local variable . The scope of an auto variables local and they initialize some garbage value for  a local variable if data isn't given.

E.g:-   #includde<stdio.h>

#include<conio.h>

void mian()

{

auto int x;

printf("value is %d",x);

getch();

}

         OUTPUT:

value is  52725872      (GARBAGE  VALUE)

2 Extern:- Extern is a storage class for all global variables. The scope of extern variables is the throughout the program nd extern variable always define outside the main function and we can use as global variable.

For e.g:-0

 #include<stdio.h>

#include<conio.h>

extern int g=10;

void main()

{

printf("%d",g);

getch();

}

3 Statics :-  Static variable is local variable but its lies as global variable . A static variable can be initialize only at once a static variable initialize by zero automatically when data is not given.

For e.g:-   #include<stdio.h>

#include<conio.h>

void main()

 {

static int  x;

printf("value is =%d",x);

getch();

                                           OUTPUT

value is =0

 

4 Register :- Register is used to define local variable that should be store in a register memory instead of   RAM   memory. Generally, it is done for fast accessing of variable because the speed of register is high the RAM . We can define variable on register only for local variable don't have any address.

For e.g:-

#include<stdio.h>

#include<conio.h>

void main()

{

register int c=10;

printf("value is =%d",c); 

getch();

}

                OUTPUT :

              value is= 10

 difference between all four variable:-

classes

 

 

 

dcgdljcdi


Classes
 Storage
 Value
 Scope
 Auto
 memory
Garbage value 
 local variable
 extern
 memory
 Zero
 global variable
 static
 memory
 Zero
 local variable
 register
CPU memory
 Garbage value
 local  variable

  All four variable in one program..........

 include<stdio.h>
#include<conio.h>
extern int y=10;
void main()
{
auto int x=1;
static int u=1;
register int s-2;

x= 1;          _________________________  This is possible .                          
x++;            

 u=1;          __________________________ This i snot possible
u ++;

s=2;           ___________________________ This is possible
s++;

 

c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming array
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming com…
c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming compiler
c programming in vs code
how learn c programming
c programming software
c programming reverse number
c programming for loop
c programming practice
c programming for beginners
c programming examples with output
c programming recursion

Sunday, March 8, 2020

c programming function | codeswithabhi

Mr. abhijeet dwivedi

              C programming function 

In this tutorials, you will learn-

Function-

 

Function is defined as to perform a particular task. In another word, a function is a group of statements that together perform a task.

There are some characteristics of function-

1 Reusability of code.
2 Reduce the complexity and reduce the size of the program 
3 Easy to resolve and issue (easy to debug).

                              Types of function:-

There are basically two types of functions which are available in c language...
1 predefine function
2 user define function

1  Predefine function:-  A predefine function are those function which already exists in the library 
For e.  clrscr( ); , getch() , printf () , scanf() ,etc

2 Userdefine function:-  A function that is defined by user aa per the requirement is known as user define function.

                                 Types of user define function :-  

There are three types of user define function are:-

1 Prototype 
2 Calling of function----------------* call by value.
                                                       * call by reference.
3 Body or definition of the function.

1 Prototype:- This is one of the most important part of user define. It is also known as a declaration of function means the name of the function number of argument and type of argument in the function and output type of a function means return value.
For e.g   syntax           
                         return type           function name    (agruments);
                              
                       output value                               
                             int                                             sum    (int,int );

2 calling of function:-  During the function call a function may accept one or more input as argument , process them and return the result to the calling program 
It can be two types are-     * Call by value.
                                          * Call by reference.

3 Body or definition of function:-   A bod of a function consist of statement which are going to perform a specific task. Afunction body consist of a single or block of statement.It is also a mandatory part of a function. 
syntax        int    sum(int x, int y)
                               {
                       int c;
                         c=x+y;
                              return(c);
                                   }
The basic structure of defining a user define function:-
# <header file>
#<header file>

function prototype    --------------------------------  1
void main()
{
function call ;    -------------------------------------  2
getch();
}
function body;  --------------------------------------    3


 For example 

#include<stdio.h>
#include<conio.h>
int sum(int,int,int);
void main()
{
int x=2,y=3,z=4,total;
total=sum(x,y,z);
printf("total is =%d",total);
getch();
}
int sum(int a,int b,int c)
{
int d;
d=a+b+c;
return(d);
}
 OUTPUT
total is =9

condition with function :-
( mannar of writing a  function )
1 Function with argument & with return value.
2 Function with argument & number of return value .
3 Function with argument & with return value .
3 Function with no argument value & no return value

Now, one  example of function with argument & no return value which make more clear this topic..
so,,
       #include<stdio.h>
      #include<conio..h >
void table(int);
     void mian() 

{
 int n;
printf("enter any no");
 scanf("%d",&n);
void table(n);
getch();
}
void table(int x)
{
int t, i;
for(i=1;i<=10;i++)
{
t=i*x;
printf("%d=%d*%d",x,i,t);
}
} 

    OUTPUT  

2*1=2
2*2=4
2*3=6
2*4=8
2*5=10
2*6=12
2*7=14
2*8=16
2*9=18
2*10=20





c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming array
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming com…
c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming compiler
c programming in vs code
how learn c programming
c programming software
c programming reverse number
c programming for loop
c programming practice
c programming for beginners
c programming examples with output
c programming recursion

So, friends, this is the information related to the topic function C programming In our next post, we discuss the call by value and call by reference in detail... so please read our next blog to know more about a function

Sunday, March 1, 2020

c program multiplication table of number

Mr. abhijeet dwivedi

C programming multiplication table of number 

In this tutorials,you will learn:-

* To generate multiplication table:-

 

So guys, before we learn the concept of table program we must to know very well loop concept.

How the loop is execute and what are the first step ,how value is initialize ,and how  compiler print the output. 

So guys if wanna know to what is loop so you check my previous post where, i explain everything about loop.

So lets start......

Now we are going to print a table of any no..

 

 #include<stdio.h>

#include<conio.h>              

void main()

{

int i=1,t,n;

printf("enter the no ");

scanf("%d",&n);

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

{

t=i*n;

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

}

getch();

}

                                                        OUTPUT

enter the no 2

2*1=2

2*2=4

2*3=6

2*4=8

2*5=10

2*6=12

2*7=14

2*8=16

2*9=18

2*10=20                                         

  So friends this is the normal\simple method to print a table of any number 

* And we are print a table by USER DEFINE  FUNCTION:-

 So before we start to print a table by user define function we must know about the Function. you can check my previous vedio to learn how function is use in the program.

Lets start,,.....

 #include<stdio.h>

#include<conio.h>

void table (int);

void main()

{

int n;

printf("enter no");

scanf("%d",&n);

table(n);

getch();

}

void table (int x)

{

int i,t;

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

{

t= i*x;

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

}

}

                                                      OUTPUT:-

enter the no  2

2*1=2

2*2=4

2*3=6

2*4=8

2*5=10

2*6=12

2*7=14

2*8=16

2*9=18

2*10=20 





c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming array
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming functions
c programming string
c programming online
c programming com…
c programming language
c programming for prime number
c programming basics
c programming structure
c programming tutorial
c programming questions for interview
c programming pdf
for c programming example
c programming examples
c programming questions
c programming interview questions
c programming hello world
what c programming
c programming online compiler
c programming multiplication table of number 
c programming examples with output
c programming recursion

So guys, this is the program to print a table by simple method and user define function....

thank you guys if you like this tutorial please like and if you not understand any thing regrading this topic . please ask  ,i reply to your queries........