-->

Hello World!

We are Cyber Assassins Cyber Assassins

View Work Contact Us

Our Blog

Showing posts with label Lyc. Show all posts
Showing posts with label Lyc. Show all posts

Simple Calculator [C]

Hey there coders welcome to cyber assassin's. I am Lyc from cyber assassin's. The post is about making a simple calculator using "C" programing language.


#Here is the code:

#include <stdio.h>
int main()
{
    char operation;
    double a, b;
    printf("Enter the first number\n");
    scanf("%lf", &a);
    printf("Enter the operation you want to do. It must be + - x ÷\n");
    scanf(" %c", &operation);
    printf("Enter the second number\n");
    scanf("%lf", &b);

switch (operation)
{
case '+':
    printf("%.2lf+%.2lf=%.2lf\n", a, b, a+b);
    break;
case '*':
    printf("%.2lfx%.2lf=%.2lf\n", a, b, a*b);
    break;
case '-':
    printf("%.2lf-%.2lf=%.2lf\n", a, b, a-b);
    break;
case '/':
    printf("%.2lf÷%.2lf=%.2lf\n", a, b, a/b);
    break;
case 'x':
    printf("%.2lfx%.2lf=%.2lf\n", a, b, a*b);
    break;
case '÷':
    printf("%.2lf÷%.2lf=%.2lf\n", a, b, a/b);
    break;

default:
    printf("Please enter a valid oparator such as + - x ÷\n");
}
    return 0;
}

Trailler




 

Multiplication Table [C]

Hey there coders welcome to cyber assassin's. I am Lyc from cyber assassin's. The post is about making a simple multiplication table using c programing language.


#Here is the code:

#include <stdio.h>

int main()
{
    int a, b, c, d, e, f, g, h, i, j, k;
    b = 1;
    c = 2;
    d = 3;
    e = 4;
    f = 5;
    g = 6;
    h = 7;
    i = 8;
    j = 9;
    k = 10;

    printf("Enter the number you want multiplication table of:\n");
    scanf("%d", &a);
    
    printf("Here is the multiplication table of %d\n",a);
    printf("%dx%d=%d\n",a,b,a*b);
    printf("%dx%d=%d\n",a,c,a*c);
    printf("%dx%d=%d\n",a,d,a*d);
    printf("%dx%d=%d\n",a,e,a*e);
    printf("%dx%d=%d\n",a,f,a*f);
    printf("%dx%d=%d\n",a,g,a*g);
    printf("%dx%d=%d\n",a,h,a*h);
    printf("%dx%d=%d\n",a,i,a*i);
    printf("%dx%d=%d\n",a,j,a*j);
    printf("%dx%d=%d\n",a,k,a*k);

    return 0;
}

It looks a little bit clear


#You may follow this one also if you want to save your time...

#include <stdio.h>

int main()
{
    int a, b=1, c=2, d=3, e=4, f=5, g=6, h=7, i=8, j=9, k=10;
    
    printf("Enter the number you want multiplication table of:\n");
    scanf("%d", &a);
    printf("The multiplication table of %d\n",a);
    printf("%dx%d=%d\n",a,b,a*b);
    printf("%dx%d=%d\n",a,c,a*c);
    printf("%dx%d=%d\n",a,d,a*d);
    printf("%dx%d=%d\n",a,e,a*e);
    printf("%dx%d=%d\n",a,f,a*f);
    printf("%dx%d=%d\n",a,g,a*g);
    printf("%dx%d=%d\n",a,h,a*h);
    printf("%dx%d=%d\n",a,i,a*i);
    printf("%dx%d=%d\n",a,j,a*j);
    printf("%dx%d=%d\n",a,k,a*k);
    return 0;
}

That's how you can make a simple multiplication table with C programing language of any number using these codes.


Thanks for visiting........


Contact Us

Phone :

+8801716815647
+8801996204467
+8801520731186

Email :

susmoy1025@gmail.com
dishantanjim@gmail.com
sadmansakib7494@gmail.com