Thursday 27 May 2021

C arrays problems

 

#include <stdio.h>

int main()
{

    int arry[10]={25,56,25,2,3,4,7,7,9,10};
    int *ptr;
    ptr = &arry[0];
     ptr++;
     ptr++;
    printf("the value of element is %d",*ptr);

    return 0;
}


#include <stdio.h>

int main()
{

    int array[10];
    int *ptr;
    ptr = array;
    ptr = ptr + 2;
    if (ptr == &array[2])
    {
        printf("the pointer point to same add");
    }
    else
    {
        printf("the pointer doesn't  point to same add");
    }

    return 0;
}


#include <stdio.h>

int main()
{

    int s[3];
    printf("the value is %d",*(s+0));

    return 0;
}


# include<stdio.h> 

 int main(){ 
int mul[10];
for (int i = 0i < 10i++)
{
    mul[i]=5*(i+1);

}
for (int i = 0i < 10i++)
{
    printf("5*%d=%d\n",i+1,mul[i]);
    
}

     
     return 0
}



#include <stdio.h>

int main()
{

    int number;
    printf("Enter the value of table U want?:");
    scanf("%d", &number);
    int mul[10];
    for (int i = 0i < 10i++)
    {

        mul[i] = number * (i + 1);
    }
    for (int i = 0i < 10i++)
    {

        printf("the value of table %d * %d = %d \n"number, (i + 1), mul[i]);
    }

    return 0;
}


#include <stdio.h>
void reverse(int *arrayint n)
{
    int temp;
    for (int i = 0i <( n / 2); i++)
    {
        temp = array[i];
        array[i] = array[n - i - 1];
        array[n - i - 1] = temp;
    }
}
int main()
{
    int array[7] = {1234567};
    reverse(array7);
    for (int i = 0i < 7 ; i++)
    {
        printf("the value is %d\n",array[i]);
    }

    return 0;
}


# include<stdio.h> 
void count(int *arr,int n){
   
    

}
 int main(){ 

     int arr[10];
     count(arr,10);
     return 0
}


#include <stdio.h>

int main()
{
    int i,j;
    int mul[3][10];
    for (i = 0; i < 3; i++)
    {
       for ( j = 0; j< 10; i++)
       {
           mul[i][j]=2*(j+1);
           mul[i][j]=7*(j+1);
           mul[i][j]=9*(j+1);


       }
       
    }
    for (i = 0; i < 3; i++)
    {
       for ( j = 0; j< 10; i++)
       {
         printf("the value of %d *%d = %d \t \t ",2,(j+1),mul[i][j]);
         printf("the value of %d *%d = %d \t \t ",7,(j+1),mul[i][j]);
         printf("the value of %d *%d = %d \t \t ",9,(j+1),mul[i][j]);


       }
       
    }
    

    return 0;
}



#include <stdio.h>

int main()
{
    int marks[3][3];
    for (int i = 0i < 3i++)
    {
        for (int j = 0j < 3j++)
        {
            printf("Enter the marks of student %d and subject %d:"i + 1j + 1);
            scanf("%d", &marks[i][j]);
        }
    }

    for (int i = 0i < 3i++)
    {
        for (int j = 0j < 3j++)
        {
            printf("the marks is %d \n",marks[i][j]);
           
        }
    }


    return 0;
}



# include<stdio.h> 

 int main(){ 
int marks[4];
for (int i = 0; i < 5; i++)
{
    printf("Enter the marks of students %d:",i+1);
    scanf("%d",&marks[i]);
}
for (int i = 0; i < 5; i++)
{
    printf(" the value   of marks is : %d \n",marks[i]);
   
}
     
     return 0
}



#include <stdio.h>

int main()
{

    int array[] = {25657895200};
    int *ptr;
    // ptr = array[0];
    ptr= array;
    for (int i = 0; i < 5; i++)
    {
        printf("the value of elments %d is %d \n",i+1,*(ptr+i));
    }
    
    return 0;
}



#include <stdio.h>

int main()
{
    int arry[]={25,65,85,98,748};
    for (int i = 0i < 5i++)
    {
        printf("the value of element %d is %d \n",i+1,arry[i]);
    }
    

    return 0;
}


#include <stdio.h>

int main()
{
    int marks[4];
    printf("Enter the marks of students:");
    scanf("%d",&marks[0]);
    printf("Enter the marks of students:");
    scanf("%d",&marks[1]);
    printf("Enter the marks of students:");
    scanf("%d",&marks[2]);
    printf("Enter the marks of students:");
    scanf("%d",&marks[3]);
    printf("Enter the marks of students:");
    scanf("%d",&marks[4]);

    printf("You have Entered the marks %d %d %d and %d ",marks[0],marks[1],marks[2],marks[3],marks[4]);


    return 0;
}



#include <stdio.h>

int main()
{
    int arr[3][2];
    

    return 0;
}



#include <stdio.h>

int main()
{
    int arr[3][4][5];
    for (int i = 0; i < 3; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            for (int k = 0; k < 5; k++)
            {
                printf("the add of arr[%d][%d][%d] is %d \n",i,j,k,&arr[i][j][k]);
            }
            
        }
        
    }
    

    return 0;
}



#include <stdio.h>

int main()
{

int marks[5];
int *ptr;
ptr=marks;
for (int  i = 0; i < 5; i++)
{
    printf("Enter the marks of student %d :\n",i+1);
    scanf("%d",ptr);
    ptr++;
}
for (int  i = 0; i < 5; i++)
{
    printf("the marks of student %d : %d \n",i+1,marks[i]);
    
}

    return 0;
}



#include <stdio.h>
void printarr(int ptr[]int n)
{
    for (int i = 0i < ni++)
    {
        printf("the value of elemnts %d is %d \n"i + 1ptr[i]);
    }
    ptr[2] = 520;
}
int main()
{
    int arr[5] = {12345};
    printarr(arr5);
    printf("%d"arr[2]);
    printarr(arr5);

    return 0;
}



#include <stdio.h>

int main()
{
    int marks[4];
    printf("Enter the marks of student 1:");
    scanf("%d",&marks[0]);
    printf("Enter the marks of student 2:");
    scanf("%d",&marks[1]);
    printf("Enter the marks of student 3:");
    scanf("%d",&marks[2]);
    printf("Enter the marks of student 4:");
    scanf("%d",&marks[3]);
    printf("The marks of students is %d %d %d and %d",marks[0],
    marks[1],marks[2],marks[3]);

    

    return 0;
}



#include <stdio.h>
void printTable(int *mulTableint numint n)
{
  printf("the multiplication table of %d \n  ", num);
  for (int i = 0; i < n; i++)
  {
    mulTable[i] = num * (i + 1);
  }
  for (int i = 0; i < n; i++)
  {
  printf("%d*%d=%d\n", num, (i + 1), mulTable[i]);
  }
  printf("*****************************************\n \n ");
}
int main()
{

  int mulTable[3][10];
  printTable(mulTable[0], 210);
  printTable(mulTable[1], 710);
  printTable(mulTable[2], 910);

  return 0;
}



#include <stdio.h>

int main()
{
    int n_student;
    int n_subject;
    printf("Enter the no of student:");
    scanf("%d", &n_student);
    printf("Enter the no of subject:");
    scanf("%d", &n_subject);
    int marks[n_student][n_subject];
    for (int i = 0i < n_studenti++)
    {
        for (int j = 0j < n_subjectj++)
        {
            printf("Enter the marks of student %d in subject %d:"i + 1j + 1);
            scanf("%d",&marks[i][j]);
        }
    }
    for (int i = 0i < n_studenti++)
    {
        for (int j = 0j < n_subjectj++)
        {
            printf("the marks of student %d in subject %d:%d\n"i + 1j + 1,marks[i][j]);
            
        }
    }

    return 0;
}



#include <stdio.h>
void positiveCount(int ptr[]int n)
{
    int n_integer = 0;
    for (int i = 0; i < n; i++)
    {
        if (ptr[i] > 0)
        {

            n_integer++;
        }
    }
    printf("No . of Positive integers are %d", n_integer);
}
int main()
{
    int arr[16] = {-1, -2, -30123456,-4,-5,54,-56,96,-85};
    positiveCount(arr, 16);

    return 0;
}



#include <stdio.h>
void printTable(int *mulTableint numint n)
{

    for (int i = 0; i < n; i++)
    {
        mulTable[i] = num * (i + 1);
    }
    for (int i = 0; i < n; i++)
    {
        printf("%d*%d=%d \n", num, (i + 1), mulTable[i]);
    }
}
int main()
{
    int m, n, num;
    printf("Enter the m rows :\n");
    scanf("%d", &m);
    printf("Enter the n column :\n");
    scanf("%d", &n);
    int mulTable[m][n];
    printf("Enter the which munber Table U want:\n");
    scanf("%d", &num);
    for (int i = 0; i < m; i++)
    {
        printTable(mulTable[m], num, n);
        
        printf("Enter the which number Table U want:\n");
        scanf("%d", &num);
        
        
        
        
    }

    return 0;
}



#include <stdio.h>

int main()
{
  int arr[3];
  int *ptr;
  ptr = arr;
  if (ptr == arr)
  {
    printf("the add lies in same add \n");
  }
  else
  {
    printf("the add lies in diff add");
  }

  return 0;
}



#include <stdio.h>

int main()
{
    int marks[5];
    for (int i = 0; i < 5; i++)
    {
        printf("Enter the marks of student %d :", i + 1);
        scanf("%d", &marks[i]);
    }
    for (int i = 0; i < 5; i++)
    {
        printf("the marks of student %d  is %d \n", i + 1marks[i]);
    }

    return 0;
}



# include<stdio.h> 
void reverse(int *arr,int n){
    int temp;
    for (int i = 0; i < (n/2); i++)
    {
      temp=arr[i];
      arr[i]=arr[n-i-1];
      arr[n-i-1]=temp;
    }
    
}
 int main(){ 
     int arr[7]={1,2,3,5,6,7,8};
     reverse(arr,7);
     for (int i = 0; i <7; i++)
    {
      printf("the value is %d \n",arr[i]);
    }

     
     return 0
}

position in CSS

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>position</title>
    <style>
        .container{
border2px solid red;
width900px;
 height3444px;
 border-radius15px;      }
.box{
    border2px solid black;
    color:black;
    background-colorwhite;
    width100px;
    height100px;
    margin5px;
    floatleft;
padding5px;
border-radius10px;


}
#box2{
    positionfixed;
}
#box3{
position:sticky;
top2px;

}


    </style>
</head>
<body>
    <div class="container">
    <div class="box" id="box1">1</div>
    <div class="box" id="box2">Chat With Us</div>
    <div class="box" id="box3">fruits 
        grapes
        orange
    </div>
    <div class="box" id="box4">4</div>
    </div>
</body>
</html>

CSS Display property

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CSS Display property</title>
    <style>
        * {
            box-sizingborder-box;
        }

        img {
            displayblock;
            marginauto;

            width100px;


        }

        h3 {
            font-familymonospace;
            text-aligncenter;
            margin0px;


        }

        header {
            border2px solid red;
            marginauto;

        }

        .box {

            border2px solid blue;
            background-colorrgb(243238248);
            margin3px auto;
            padding25px;
            displayinline-block;
            width30%;
            box-sizingborder-box;
        }

        .container {
            marginauto;
            width1200px;
        }

        .box h3 {
            text-alignleft;
        }
    </style>
</head>

<body>
    <header class="top">
        <img src="https://c1.sfdcstatic.com/content/dam/blogs/ca/Blog%20Posts/anatomy-of-a-blog-post-deconstructed-open-graph.jpg"
            alt="img blogs with pcs">
        <h3>Welcome To Upendra Blogs</h3>
    </header>
    <div class="container">
        <div class="box">
            <h3 class="heading">heading</h3>
            <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Corrupti cum ad obcaecati voluptatem facere,
                ullam, placeat recusandae voluptatum repudiandae magni vel repellat quae? Dolore molestiae aliquid,
                possimus velit necessitatibus numquam ad sit ullam vel.</p>
        </div>
        <div class="box">
            <h3 class="heading">heading</h3>
            <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Corrupti cum ad obcaecati voluptatem facere,
                ullam, placeat recusandae voluptatum repudiandae magni vel repellat quae? Dolore molestiae aliquid,
                possimus velit necessitatibus numquam ad sit ullam vel.</p>
        </div>
        <div class="box">
            <h3 class="heading">heading</h3>
            <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Corrupti cum ad obcaecati voluptatem facere,
                ullam, placeat recusandae voluptatum repudiandae magni vel repellat quae? Dolore molestiae aliquid,
                possimus velit necessitatibus numquam ad sit ullam vel.</p>
        </div>


    </div>

</body>

</html>

navigation CSS

 

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>navigation </title>
    <style>
        .navbar {
            background-colorred;

        }

        .navbar li {
            floatleft;
            list-stylenone;
        }

        .navbar ul {
            overflowauto;
        }

        .navbar li a {
            padding3px 3px;
            margin3px 3px;
        }
    </style>
</head>

<body>
    <header>
        <nav class="navbar">
            <ul>
                <li><a href="#">Home</a></li>
                <li><a href="#">About</a></li>
                <li><a href="#">Services</a></li>
                <li><a href="#">Contact Us</a></li>
            </ul>
        </nav>
    </header>

</body>

</html>



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>navigation </title>
    <style>
.navbar{
    background-colorblack;
    border-radius15px;

}
.navbar li{
    floatleft;
    list-stylenone;
    margin10px;

}
.navbar ul{
    overflowauto;
    margin5px 10px;
}
.navbar li a{
padding20px 5px;
colorwhite;
text-decorationnone;
}
.navbar li a:active{
    colorred;
}
.navbar li a:hover{
background-coloryellow}
.search{
    floatright;
    colorwhite;
    padding10px ;
    
    }
    .navbar input{
        border-radius10px;
        padding5px;

    }

    </style>
</head>
<body>
 <header>
     <nav class="navbar">
         <ul>
           <li><a href="#">Home</a></li>
           <li><a href="#">About</a></li>
           <li><a href="#">Services</a></li>
           <li><a href="#">Contact Us</a></li>
           <div class="search">
               <input type="text" name="search " id="search" placeholder="Type here to search">
           </div>
         </ul>
     </nav>
 </header>

</body>
</html>

Python if / else

 Python if / else a1 = int ( input (" Enter the number: \n ")) a2 = int ( input (" Enter the number: \n ")) a3 = int ( i...