Skip to main content

WHAT IS CSS?ADVANTAGES, SYNTAX.

 CSS PROGRAMMING LANGAUGE                                                                     disadvantages CSS full form is cascade style sheets , which we call it says about how you should display the HTML elements on the screen. CSS tells us the style of the webpage let us take a simple example, if we build a home first we lay out the design that is known as the HTML language. Where the CSS means layout which means giving instructions on how the furniture should be nothing but the CSS. For example if we take PayPal we can see that the background color blue says the CSS background-color property. Netflix is also the best way of saying  CSS property, but if we remove it will be a normal webpage but with the red color and the black plus symbols it looks like the best webpage. Versions of CSS There are differen...

ARRAYS IN C?SCALAR VARIABLE,DISADVANTAGES

SCALAR VARIABLE:-

                                                     
array




  • A scalar variable is that which can hold only one value it is known as a scalar variable.
  • For eg:-int a=10;
                         a=30;

DISADVANTAGES OF SCALAR VARIABLE:-    

  • Whenever multiple data items are required to be in the computer memory and access those data items scalar variables have 2 limitations: increase code and performance problems.

AGGREGATE VARIABLE:-

  • A variable that can hold multiple values(data items) is known as an aggregate variable.

WHAT IS AN ARRAY:-

  • An array is an index-based collection of homogenous elements, the array is a collection of  (continuous) memory locations referred to by a common name that can hold multiple values.
  • Is a subscripted variable that can multiple data items of the same data type and it is an aggregate variable.
  • Whenever multiple data items of the same type are required to be stored in computer memory we go for an array, for eg:-marks of all the students of a class, salaries of all the employee's company.

DECLARING ARRAY:-

  • <DATA TYPE>  <IDENTIFIER>[SIZE];   declaring an array means first we need to specify the data type whether it is int, float, char, and give space, declare the variable and size.
  • For eg:-int a[5]; in the above example, an integer array of size 5 is created.
  • The first index of an array is nothing but its lower bound, always it is 0, the last index of an array is its upper bound, it is n-1 where n is the size of the array.
  • In the above diagram, the lower bound is 0 and the upper bound is 4 because we declared 5 as the size(5-1).

  PROGRAM ON ARRAY:-  Store the first ten natural numbers in an integer array.

  #include<stdio.h>
 #define size 10//named constant
 void main()
 {
  int n[size];
  int i;//loop counter
 for(i=0;i<size;i++)
{
  n[i]=i+1;
}
for(i=0;i<size;i++)
{
printf("%d\n",n[i]);
}https://www.geeksforgeeks.org/advantages-and-disadvantages-of-array-in-c/
}//main

PROGRAM:-To store even numbers of the first 10 natural numbers into an array and display.

#include<stdio.h>
#define size 5//named constant created
void main()
{
  int n[size];
  int i;//loop counter
  for(i=0;i<size;i++)
 {
  n[i]=2*(i+1);
  }
 for(i=0;i,size;i++)
 {
 printf("%d\n",n[i]);
 }
}//main

PROGRAM:-Read the marks of 5 students from the keyboard store in computer memory and display the same.


#include<stdio.h>
void main()
{
 int m[5];
 int i;
 for(i=0;i<5;i++)
 {
  printf("enter student %d marks:",i+1);
  scanf("%d",&m[i]);
 }
 for(i=0;i<5;i++)
{
 printf("student %d marks %d\n",i+1,m[i]);
 }
}//main

PROGRAM:-Store the first 10 natural numbers into an array and display the elements of the array in reverse.


#include<stdio.h>
void main()
{
 int n[10];
 int i;
 for(i=0;i<10;i++)
{
 n[i]=i+1;
 }
for(i=0;i>10;i--)
{
printf("%d\t",n[i]);
}
}//main

ONE-DIMENSIONAL ARRAY:-An array that has a single subscript for eg-int a[10];
in a single-dimensional array, elements are stored in a linear fashion.

#include<stdio.h>
void main()
{
 int a[5]={10,20,30,40,50};
 int b[5];
 int i;
 for(i=0;i<5;i++)
 {
  b[i]=a[i];
  }
 printf("elements of the first array.....\n");
 for(i=0;i<5;i++)
 {
  printf("%d\t",a[i]);
 }
 printf("\n elements of the second array...\n");
 for(i=0;i<5;i++)
 {
  printf("%d\t",b[i]);
 }
}//main
 
PROGRAM:-Initalize an integer array with 5 numbers, interactively search for an element in the array.

#include<stdio.h>
void main()
{
 int a[5]={10,20,30,40,50};
 int n;
 int i;
 int flag=0;
 printf("enter the number to search in the list:");
 scanf("%d",&n);
 for(i=0;i<5;i++)
{
 if(n==a[i])

 flag=1;
 break;
}
}
if(flag)
printf("%d is found at the index %d in the list",n,i);
else 
printf("%d is not found in the list");
}

TWO-DIMENSIONAL ARRAY:-
  • An array that has 2 subscripts is nothing but a two-dimensional array.
  • First subscript represents the number of rows and second represents the number of columns, a two-dimensional array represents data in a tabular/matrix format.

#include<stdio.h>
void main()
{
 int n[2][2]={{10,20},{30,40}};
 printf("%d\t",n[0][0]);
 printf("%d\n",n[0][1]);
 printf("%d\t",n[1][0]);
 printf("%d",n[1][1]);
}

  •  In the previous blogs we read about operators and their types including arithmetic,  assignments.












Comments

Popular posts from this blog

WHAT IS CSS?ADVANTAGES, SYNTAX.

 CSS PROGRAMMING LANGAUGE                                                                     disadvantages CSS full form is cascade style sheets , which we call it says about how you should display the HTML elements on the screen. CSS tells us the style of the webpage let us take a simple example, if we build a home first we lay out the design that is known as the HTML language. Where the CSS means layout which means giving instructions on how the furniture should be nothing but the CSS. For example if we take PayPal we can see that the background color blue says the CSS background-color property. Netflix is also the best way of saying  CSS property, but if we remove it will be a normal webpage but with the red color and the black plus symbols it looks like the best webpage. Versions of CSS There are differen...

WHAT IS HTML?HEADING TAGS

 WHAT IS HTML?                                                                 HTML  stands for hypertext markup language this is the full form of HTML. HTML is an important markup language for creating web pages. If we see any website then click the link we go to another page which is known as the web page,           combination of these web pages is known as a websit e . It is known by the name html because it is used to make the content in it more presentable. The first line of any html code is <!doctype> which is the most important step we could say. Tin Berners Lee has created the HTML programming language, and version 4.0 has become the most popular one. BASIC PROGRAM IN HTML <html> <head> <title>page title</title> <body> <h1>hi</h1> </bod...

HTML STYLES?FONT SIZE,BACKGROUND COLOUR

 HTML STYLES                                                                  background colour In HTML  have different styles like background color, font size, text color, and text alignment in this blog we are going to study different HTML styles. HTML styles that are used to change or else change whatever existing HTML tags. We have different types of styles internal styling, which is nothing but using this inside the html element. Internal means utilizing it in the head section of the HTML code, external is to apply it externally to the CSS file. BACKGROUND COLOUR We will use background color as a style in HTML for webpages to give color to the web pages of different colors like blue, red, black, etc. and there will be a syntax for giving background color. <body style="background-color: green;"> This is...