Testing.

Thursday, 29 December 2016

C programming language: C program to divide a number (mathematics operation).


// Normal program
#include<stdio.h>
#include<conio.h>
void main()
{
int a=40,b=2;
printf("Result: =%d",a/b);
getch();
}

output:-20

//Ask numbers from user to divide
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
float c;
printf("\n Enter Number: ");
scanf("%d %d",&a,&b);
c=a/b;
printf("Result: =%f",c);
getch();
}



No comments:

Post a Comment