Posts

Featured post

Conditions and If Statements in C++

   Conditions and If Statements in C++ C++ has the following conditional statements: Use  if  to specify a block of code to be executed, if a specified condition is true Use  else  to specify a block of code to be executed, if the same condition is false Use  else if  to specify a new condition to test, if the first condition is false Use  switch  to specify many alternative blocks of code to be executed The if Statement Use the  if  statement to specify a block of C++ code to be executed if a condition is  true . if  ( condition ) {    // block of code to be executed if the condition is true } EG: int  x =  20 ; int  y =  18 ; if  (x > y)  {   cout <<  "x is greater than y" ;  } Less than:  a < b Less than or equal to:  a <= b Greater than:  a > b Greater than or equal to:  a >= b Equal to  a == b Not Equal to:  a != b You can use these conditions to perform different actions for different decisions. Thanks for your time, if you enjoy the lecture share l

C Program to find Sum of Matrices

Image
  Program :- #include <stdio.h> void main() {  int r,c,i,j,first[10][10],second[10][10],sum[10][10];  printf("\nSum Of Matrices");  printf("\n-----------------------");  printf("\nEnter the number of rows : ");  scanf("%d",&r);  printf("\nEnter the number of coloumns : ");  scanf("%d",&c);  printf("\n Enter the elements of first Array : ");  for(i=0;i<r;i++)  {  for(j=0;j<c;j++)  {  scanf("%d",&first[i][j]);  }  }  printf("\n Enter the elements of second Array : ");  for(i=0;i<r;i++)  {  for(j=0;j<c;j++)  {  scanf("%d",&second[i][j]);  }  }  printf("\nSum of enterd matrices : \n");  for(i=0;i<r;i++)  {  for(j=0;j<c;j++)  {  sum[i][j]=first[i][j]+second[i][j];  printf("%d\t",sum[i][j]);  }    printf("\n");  } } Output For video classes :  Prastheena Learning Class

Whether a given number is prime or not

Image
#include<stdio.h> void main() { int n,i=2; printf("\nEnter a number \n"); scanf("%d",&n); for(i=2;i<=n-1;i++) { if(n%i==0) { printf("%d isn't prime...!\n",n); break; } } if(i==n) printf("%d is prime...!\n",n); } Output Video Class :   Prastheena Learning Class

ALGORITHM

Image
  ALGORITHM * The origin of the word algorithm to a famous Arab mathematician,  ABU JAFAR MOHAMMED IBN MUSAA AL- KHOWARIZMI . * T he word 'algorithm' is derived from the last part of his name AL-KHOWARIZMI. *     In computer terminology an algorithm may be defined as a finite sequence of instructions to solve a problem. * It is a step-by-step procedure to solve a problem, where each step represents a specific task   to be carried out.   CHARACTERISTICS ·         It should begin with instructions to accept inputs. ·         Use variables to refer the data , where variables are user-defined works consisting of alphabets & numerals. ·         Each & every instructions should be precise & unambiguous. ·         Each instructions must be sufficient ·         The total time to   carry out all the steps in the algorithm must be finite. ·         After performing the instructions given in the algorithm ,the desired results must be obtained.   APP

C Program to Check Odd or Even using IF Condition

Image
   #include<stdio.h> int main() {   int number;   printf(" Enter an int value to check Even or Odd \n");   scanf("%d", &number);   if ( number%2 == 0 ) //Check whether remainder is 0 or not      printf("Given number %d is EVEN NUMBER \n", number);   else     printf("Given number %d is ODD NUMBER \n", number);   return 0; }   Output Enter an int value to check even or odd :3 Given   number 3 is   ODD NUMBER   Enter an int value to check even or odd :2 Given   number 2 is   EVEN   NUMBER    

What is computer ?

Image
  A n electronic device for storing and processing data. It is typically in binary form, according to instructions given to it in a variable program. Is a programmable electronic device designed to accept data, perform prescribed mathematical and logical operations at high speed, and display the results of these operations .  Mainframes, desktop and laptop computers, tablets, and smartphones are some of the different types of computers.

Turing machine

Image