ASCII TABLE IN LOWERCASE IN JAVASCRIPT

Ascii Table in Lowercase Using array for loop in JavaScript


let arr = [];
// Defined variable arr

for (let i = 97; i <= 122; i++) { 
// Create a variable named i in the for loop, start the value 
// of i from 97 and run it till 122 with the help of i++

  console.log(i + "  =  " + String.fromCharCode(i));
// Now we see that the ascii value is being printed
// from number 97 till number 122 (Lowercase a to z).
}

Output


97  =  a
98  =  b
99  =  c
100  =  d
101  =  e
102  =  f
103  =  g
104  =  h
105  =  i
106  =  j
107  =  k
108  =  l
109  =  m
110  =  n
111  =  o
112  =  p
113  =  q
114  =  r
115  =  s
116  =  t
117  =  u
118  =  v
119  =  w
120  =  x
121  =  y
122  =  z

How to use floating point arithmetic operators in C language

Program to use floating point arithmetic operators in C language


#include <stdio.h>
int main()
{
    float a = 12.4, b = 3.8;
    printf("Sum=%.2f\n", a + b);
    printf("Difference=%.2f\n", a - b);
    printf("Proudct=%.2f\n", a * b);
    printf("a/b=%.2f\n", a / b);
    return 0;
}

Output


Sum=16.20
Difference=8.60
Proudct=47.12
a/b=3.26

Steps / Description

  1. Declare variable float a and b
  2. Initialize in float variable a = 10.4, b = 5.8
  3. printf inbuild function to display sum of variable a > and b with decimal place holder %f
  4. prinf inbuild function to display difference of variable a and b with decimal place holder %f
  5. printf inbuild function to display product of variable a and b with decimal place holder %f
  6. printf inbuild function to display a/ba and b with decimal place holder%f

How to use function with no arguments and no return values in C Language

Program to use function with arguments and no return values in C Language


#include <stdio.h>
void displaymenu(void);
int main()
{
    int choice;
    displaymenu();
    printf("Enter your choice");
    scanf("%d", &choice);
    return 0;
}
void displaymenu(void)
{
    printf("1.Create database\n");
    printf("2.Insert new record\n");
    printf("3.Modify a record\n");
    printf("4.Delete a record\n");
    printf("5.Display all records\n");
    printf("6.Exit\n");
}

Output


1.Create database
2.Insert new record
3.Modify a record
4.Delete a record
5.Display all records
6.Exit
Enter your choice

ASCII TABLE IN UPPERCASE IN JAVASCRIPT

Ascii Table in Uppercase Using array.push in JavaScript


let arr = [];
for (let i = 65; i <= 90; i++) { 
// ran the for loop from 65 to 90 

arr.push(String.fromCharCode(i));
// convert to letter to number in array.push in JavaScript
}
console.log(arr);
// Now we see that the ascii value is being printed
// from number 65 till number 90 (Uppercase A to Z).

Output



[
  'A', 'B', 'C', 'D', 'E', 'F',
  'G', 'H', 'I', 'J', 'K', 'L',
  'M', 'N', 'O', 'P', 'Q', 'R',
  'S', 'T', 'U', 'V', 'W', 'X',
  'Y', 'Z'
]

How to use factorial of a number in C language

Program to use factorial of a number in C language


#include <stdio.h>
long int factorial(int n);
int main()
{
    int num;
    printf("enter a number :");
    scanf("%d", &num);
    if (num < 0)
    {
        printf("no factorial of negative number\n");
    }

    else
    {
        printf("factorial of %d is %ld\n", num, factorial(num));
    }

    return 0;
}
long int factorial(int n)
{
    int i;
    long int fact = 1;
    if (n == 0)
        return 1;
    for (i = n; i > 1; i--)
    {

        fact *= i;
        printf("i %d\t fact %ld\n", i, fact);
    }
    return fact;
}

Output


i 5 fact 5
i 4 fact 20
i 3 fact 60
i 2 fact 120
factorial of 5 is 120

How to use find out the factorial of a number in C language

program to use find out the factorial of a number in C language


#include <stdio.h>
long int factorial(int n);
int main()
{
    int num;
    printf("Enter a number : ");
    scanf("%d",&num);
    if(num<0)
    printf("No factorial of negative number\n");
    else 
    printf("Factorial of %d is %ld\n",num,factorial(num));
    return 0;
} 
long int factorial(int n)
{
    int i;
    long int fact=1;
    if(n==0){
           return 1;
    }
    for(i=n; i>1; i--){
        fact*=i;
    }
    
    
    return fact;
}

output


Enter a number : 8
Factorial of 8 is 40320

How to use whether a number is even or odd in C language

program to use whether a number is even or odd in C language


#include <stdio.h>
void find(int n);
int main()
{
    int num;
    printf("Enter a number : ");
    scanf("%d",&num);
    find(num);
    return 0;
}
void find (int n)
{
    if(n%2==0)
    printf("%d is even\n",n);
    else
    printf("%d is odd\n",n);
}

output


Enter a number : 444
444 is even

How to use function find the sum of two numbers in C language

program to use function find the sum of two numbers in C language


#include <stdio.h>
int sum(int x,int y)
{
    int s;
    s=x+y;
    return s;
}
int main()
{
    int a,b,s;
    printf("Enter value for a and b : ");
    scanf("%d %d",&a,&b);
    s=sum(a,b);
    printf("sum of %d and %d is %d\n",a,b,s);
    return 0;
}

output


Enter value for a and b : 12
6
sum of 12 and 6 is 18

How to use find the sum of two numbers in C Language


#include <stdio.h>
int sum(int x, int y) /*function definition*/
{
    int s;
    s = x + y;
    rextturn s;
}
int main(void)
{
    int a, b, s;
    printf("Enter values for a and b : ");
    scanf("%d %d", &a, &b);
    s = sum(a, b); /*function call*/
    printf("Sum of %d and %d is %d\n", a, b, s);
    return 0;
}

Output


Enter value for a and b :12
6
Sum of 12 and 6 is 18