Saturday 6 July 2019

How to make a calculator in C language

calculator in c using switch case statement

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,ch,result;
while(1)
{
printf("\n1. addition");
printf("\n2. subtraction");
printf("\n3. multiplication");
printf("\n4. division");
printf("\n5. exit");
printf("\n enter you choice:-");
scanf("%d",&ch);
switch(ch)
{



case 1:
printf("enter two numbers:-");
scanf("%d%d",&a,&b);
result=a+b;
printf("sum is %d",result);
break;


case 2:
printf("enter two numbers:-");
scanf("%d%d",&a,&b);
result=a-b;
printf("subtraction is %d",result);
break;


case 3:
printf("enter two numbers:-");
scanf("%d%d",&a,&b);
result=a*b;
printf("multiplication is %d",result);
break;

case 4:
printf("enter two numbers:-");
scanf("%d%d",&a,&b);
result=a/b;
printf("division is %d",result);
break;

case 5:
exit(0);
default:
printf("invalid entry");
}
}
getch();

}




if you want to learn more programing and programing practice in c language then comment below and follow this blog...thanks to all of you..

Wednesday 3 July 2019

C basic programing by Amarjeet kumar singh

How to Print Hello world programe in C



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

void main()     /*code will start execution from main */
{
clrscr();     
printf("Hello world");
getch();
}


How to add two numbers in C to taking input from the users


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

void main()
{
int a,b,sum;  
clrscr();
printf("enter first number:");
scanf("%d",&a);
printf("enter second number:");
scanf("%d",&b);
sum=a+b;
printf("your sum is=%d",sum);
getch();
}

How to print table in c using for Loop


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

void main()
{
inta,b;
clrscr();
printf("enter the number :");
scanf("%d",&a);
for(b=1;b<=10;b++)
{
printf(%d*%d=%d\n",a,b,a*b);
}
getch();
}



C program to swap two numbers 

#include<stdio.h>
#include<conio.h>
void main()
{
    int a,b,temp;
    printf("enter the two numbers:");
    scanf("%d%d",&a,&b);
    temp=a;
    a=b;
    b=temp;
    printf("a=%d b=%d",a,b);
    getch();
}


How to print area of circle and circumference in C

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

void main()
 {

   int rad;
   float PI = 3.14, area, ci;

   printf("\nEnter radius of circle: ");
   scanf("%d", &rad);

   area = PI * rad * rad;
   printf("\nArea of circle : %f ", area);

   ci = 2 * PI * rad;
   printf("\nCircumference : %f ", ci);

   getch();
}



To learn more programing and practice in C language follow this blog thanks have a nice day to all of you.






top 5 website for computer science students

top 5 website for computer science students

Hii friends i am amarjeet kumar singh.today i am going to tell you some useful website on the internet.so if you are computer science student or student then you should have to visit on this website at onces.because these website will be better for you. if you follow them.as well as you can learn more and more about computer or computer programming.


List of 5 website


  • Javatpoint
  • geeksforgeeks
  • Tutorialspoint
  • Studytonight
  • W3schools
  • Indiabix

List of website for coding practice


  • Hackerrank
  • Codechef
  • Hackerearth
  • geeksforgeeks


Featured post

 Top 10 Array Coding Question For Interview: (1)Write a program to find smaller element in Array Solution:      public class SmallerElementI...