Skip to main content

How to get division of 2 integer number in c language. || division program in c language.

  How to get a division of 2 numbers in c language. Division of two integer number in c Division of 2 integer number:     here we want to get a division of 2 number so for that we have to take 3 variable  1st is for Dividend, 2nd is for divisor and, 3rd is for an answer.     the simple logic is  a= b/c.     here variable "a" get value which is the division of b and c in other words we can say that a is the answer of b divide by c. we show you to way to get an answer. 1) In this way, we have to just take the answer in 3rd variable, and then after we have to print that variable. hear we take div as answer variable. Example:: #include<stdio.h> #include<conio.h> void main() {     int a,b,div;     clrscr();     printf("\nWelcome,CoderFact\n---------------Division---------------");     printf("\nEnter a First Number(Divisior) :");     scanf("%d",&a);     printf("\nEnter a S...

What is use of Scanf Function in C Language || 100% you don't know this type of working in programing language

 Uses Of "scanf" function in C language.

scanf Function:

        syntax of scanf:  scanf(const char *format, Object *arg(s))

        scanf if a function which is use for scan an input from user. scanf is a library function which in standard   input output library. scanf is some ware like as prinf function. scanf function scan a input from an user via standard input (keyboard).

       scanf  function is derived from  #include<stdio.h> library ( Standard input output libraries.)

Hear we will see some example of different type of value scan by scanf .

1) For integer Value scan.

Example :

#include<stdio.h>
#include<conio.h>
void main()
{
    int a;
    clrscr();
    printf("\nWelcome,CoderFact");
    printf("\nEnter a number : ");
    scanf("%d", &a);
    printf("Your entered a number is :  %d " , a);
    getch();
}


OUTPUT ::














we pass 5 as input form keyboard and we can see scanned number as 5.
hear we use %d to scan an integer value. %d is a specifier that specify that the number is an integer. simply %d is stand for decimal  integer number.


2) For character scan.

Example :

#include<stdio.h>
#include<conio.h>
void main()
{
    char a;
    clrscr();
    printf("\nWelcome,CoderFact");
    printf("\nEnter a name : ");
    scanf("%c", &a);
    printf("Your entered a name is :  %c " , a);
    getch();
}


OUTPUT ::















we pass 5 as input form keyboard and we can see scanned number as 5.
hear we use %d to scan an integer value. %d is a specifier that specify that the number is an integer. simply %d is stand for decimal  integer number.



Example :

#include<stdio.h>
#include<conio.h>
void main()
{
    char a[10];
    clrscr();
    printf("\nWelcome,CoderFact");
    printf("\nEnter a name : ");
    scanf("%s", &a);
    printf("Your entered a name is :  %s " , a);
    getch();
}



OUTPUT ::















Example::



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

void main()
{
    float a;
    clrscr();
    printf("\nWelcome,CoderFact");
    printf("\nEnter a float number : ");
    scanf("%f", &a);
    printf("Your entered a number is :  %f",a);
    getch();
}



OUTPUT::



















Comments

Popular posts from this blog

How to print folat numbers in c language and what are the formation of float variable.

How to print float number in c language.  Floating numbers are basically real numbers.  if we want to print folat numbers in c language for that we have to take %f as keyword in printf and scanf function.  Example : For scanning: Scanf("%f",&variable name); For printing: Printf("foat num is %f.",variable name); There are Diffrent formats  to print float number in c language. Hear we take 1 example which shows you that if we want to print 2 digit after "." Than we have to just write " .2 " in calling printf sattment.  Example: #include<stdio.h> #include<conio.h> void main() {     float a;     clrscr();     printf("\nWelcome,CoderFact");     printf("\nEnter a number : ");     scanf("%f", &a);     printf("Your entered a number is :  %.2f " , a);     getch(); } OUTPUT:: Hear we pass value 12 and we get output  12.00 this thing is occur due to we take input as float nu...

"Hello World" Program of C Language || First Program

C language: "hello world"  program  Code:  #include<stdio.h> #include<conio.h> void main() {          clrscr();          printf("hello world");          getch(); } OUTPUT: Program how it's work #include<stdio.h> and #include<conio.h> are basic library of C language  void main() is a funtion that use for execution of programm clrscr() is use for clear the output screen printf() function is use for write any things on output screen getch() is make output screen freeze until it get any character.   For video Tutorial    Click here       

Useful Formula for Programmar

  Simple Interest  ::                                     Si =(p* n*r)/100 Area of Square ::                                                          Area =side* side Area of Rectangle ::                                                           Area = length * breadth Area of Right angled triangle ::                                               Area =(...