For C For JS

  1. Basic of C program:- comment and print function.

  2.                 
    // This is a single line comment...
                
    /*this is a multi line
    comment*/
                
    #include<stdio.h>   //Header file..
    #include<conio.h>  //Header file..
    int main()        //first Code runs from here..
    {
        printf("Hello world!");  //Printf is the function to print..
        return 0;       //Returns the value. Here, it return nothings means 0..
    }  
                    
                    

  3. C program to find Simple Intrest.

  4.                 
    #include<stdio.h>
    #include<conio.h>
    
    int main()
    {
        float si, p, t, r;
        printf("Enter principle(P): \n");
        scanf("%f",&p);
        printf("Enter time(T): \n");
        scanf("%f",&t);
        printf("Enter rate(R): \n");
        scanf("%f",&r);
        si=(p*t*r)/100; //formula to calculate Simple intrest......
        printf("The simple intrest is: %f", si);
        return 0;
    }
                    
                    

  5. C program to find whether the entered number is positive or negative.

  6.                 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int a;
        printf("\nEnter a number(Not zero): ");
        scanf("%d",&a);
    
        if (a < 0)
        {
            printf("\nIts negative number");
        }
        else
        {
            printf("\nIts positive number");
        }
    
    
            return 0;
    }
                    
                    

  7. C program to find whether the entered number is odd or even.

  8.                 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int a;
        printf("\nEnter a number: ");
        scanf("%d",&a);
    
        if (a%2==0)
        {
            printf("\nIts even number");
        }
        else
        {
            printf("\nIts odd number");
        }
    
    
        return 0;
    }
                    
                    

  9. C program to arrange 10 user input number in ascending order.

  10. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
    int n[50],t;
        for (int i = 0; i < 10; i++)
        {
            printf("\nEnter a number: ");
            scanf("%d",&n[i]);
        }
    
        for (int i = 0; i < 10-1; i++)
        {
            for (int j = i+1; j < 10; j++)
            {
                if (n[i]>n[j])
                {
                    t=n[i];
                    n[i]=n[j];
                    n[j]=t;
    
                }
                
            }
            
        }
        printf("\nNumber in ascending order are: ");
        for (int i = 0; i < 10; i++)
        {
            printf("\n%d",n[i]);
        }
        
        
        
        return 0;
    }
    
    

  11. C program to show simple switch case.

  12. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int a,b,ch,m;
        printf("\nEnter first number: ");
        scanf("%d",&a);
        printf("\nEnter second number: ");
        scanf("%d",&b);
        printf("\nEnter 1 for finding sum\nEnter 2 for finding differnce\nEnter 3 for finding greaternumber\nyou have entered: ");
        scanf("%d",&ch);
        switch (ch)  //switch to the var ch
        {
        case 1:
            m=a+b;
            printf("\nThe sum is: %d",m);
            break;
        case 2:
            m=a-b;
            printf("\nThe differnce is: %d",m);
            break;
        case 3:
           if (a>b) // to find greates number
           {
               printf("%d is greates number\n",a);  
           }
           else
           {
               printf("%d is greates number\n",b);
           }
        
            break;
    
        default:
        printf("\nYou should press 1/2/3 only\nThank you");
            break;
        }
        
        return 0;
    }
    
    

  13. C program to show simple array example And to find Smallest number in array.

  14. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
    int max,i;
    int a[10]; //array declearing......
    printf("\nEnter 5 positive numbers:\n");
    for (int i = 0; i < 5; i++) //array always starts from 0..
    {
        scanf("%d",&a[i]);
    }
        max=a[0];
        for (int i = 0; i > 5; i++)
        {
            if (a[i]<max)
            {
              max=a[i];
            }
            
        }
        printf("\nSmallest number in array is: %d",max);
        
        return 0;
    }
    
    

  15. C program to display number of digit you entered.

  16. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int n,count=0;
        printf("Enter the number: ");
        scanf("%d",&n);
        for ( n == 0; n++;)
        {
            count=count+1;
            n=n/10;
        }
        printf("\nThere are %d digit in your number",count);
        
    
        return 0;
    }
        
    
    

  17. C program to calculate electricity bill.

  18. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        float n,u;
        printf("Enter Unit:");
        scanf("%f",&n);
        if (n<=20)
        {
            printf("\nTotal amount(Rs.) = 80");
        }
        else if (n<=30)
        {
            u=n*7.5+80;
            printf("\nTotal amount(Rs.) = %f",u);
        }
        else if (n<=50)
        {
            u=n*10+80;
            printf("\nTotal amount(Rs.) = %f",u);
        }
        else if (n<=80)
        {
            u=n*12.5+80;
            printf("\nTotal amount(Rs.) = %f",u);
        }
        else
        {
            u=n*15+80;
            printf("\nTotal amount(Rs.) = %d",u);
        }
        
        
        return 0;
    }
        
    
    

  19. C program to display fibonacci series to n term.

  20. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int a=1,b=1,c=0,n;
        printf("\nEnter the limit: ");
        scanf("%d",&n);
        for (int i = 1; i <= 10; i++)
        {
            printf("%d, ",a);
            c= a+b;
            a=b;
            b=c;
        }
        
    
        return 0;
    }
        
    
    

  21. C program to find whether the entered number is Perfect number or not.

  22. 
    #include<stdio.h>
    #include<conio.h>
    int main()
    {
        int n,sum=0;
        printf("Enter the number: ");
        scanf("%d",&n);
        for (int i = 1; i < n; i++)
        {
            if (n%i==0)
            {
                sum=sum+i;
            }
        }
        if (sum==n)
        {
            printf("\nPerfect number");
        }
        else
        {
            printf("\nNot perfect");
        }
        
        
        return 0;
    }
        
    
    

  1. JS to display another content on another button click.

  2.                 
                        
        let btnText = document.querySelector('#btnText');
        let text = document.querySelector('#text');
        let htmle = document.querySelector('#htmle');
        let btnHtml = document.querySelector('#btnHtml');
        
        htmle.style.display='none';
        text.style.display="";
        btnText.addEventListener('click', () => {
            htmle.style.display='none';
            text.style.display="";
        });
        btnHtml.addEventListener('click', () => {
            text.style.display='none';
            htmle.style.display='';
        });
        
    
                    
                

  3. JS of working contact page (G-mail).

  4.                 
                        
    function sendEmail(){
        Email.send({
            Host : "smtp.gmail.com",
            Username : "123web.site8@gmail.com",
            Password : "obktvhspdnlhxhxq",
            To : '123web.site8@gmail.com',
            From : document.getElementById("email").value,
            Subject : "From portfolio Website",
            Body : "Name: " + document.getElementById("name").value +"Email: " + document.getElementById("email").value + "Message: " +document.getElementById("message").value
        }).then(
          message => alert("Message send successfully")
          );
        }
                            
        
    
                    
                

  5. JS to display typing effect.

  6.                 
                        
    // typing animation script
        var typing = new Typed(".typing", {
            strings: ["Student.",
            "Web Developer."],
            typeSpeed: 100,
            backSpeed: 60,
            loop: true
        });