WAP of C Language that Search For a Desired Element in an Array of N Natural Numbers

Engg.... | 00:01 | | Best Blogger Tips
 Search Array Element
Statement of C Program: This Program Searches for a desired element in a set of n Numbers:

#include<stdio.h>
#include<conio.h>
void main()
{
int n, i , found , key_element ;
int listn[20];
clrscr();
printf(" Enter the Number of elements in the Array\n");
scanf("%d" , &n);
read more

WAP that Accepts Two Arrays and Compute the Sum of Corresponding Elements of Two Arrays

Engg.... | 19:26 | | Best Blogger Tips
Sum of Two Arrays

Note: C does not support performing any operation on the entire Array. The whole Array cannot be processed as a single element. But, it allows the Programmer to perform certain operations on an element-by-element basis.

So, Let us understand this Note with the help of Example:

Statement of C Program: This Program accepts two integer Arrays and Find the Sum of the corresponding elements of these Arrays:

#include<stdio.h>
#include<conio.h>
void main()
read more

WAP to Calculate the Sum of Even and Odd Numbers Stored in an Array

Engg.... | 06:38 | | Best Blogger Tips
Even Odd Numbers

Statement of C Program: This Program computes the Sum of Even and Odd Numbers stored in an Array of N integers:

#include<stdio.h>
#include<conio.h>
void main()
{
int num[20];
int i , esum , osum , N;           
/* esum stands for Sum of Even Numbers and osum stands for Sum of Odd Numbers */
read more

Write a Program (WAP) of C Language to Find out Sum of all Array elements

Engg.... | 00:10 | | Best Blogger Tips
Sum Of Array elements

Statement of C Program: This Program calculates or compute the Sum of all Array elements:

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5] ;
int i , s;
clrscr();

read more

Write a Program (WAP) of Initialization of an Array Elements

Engg.... | 02:27 | | Best Blogger Tips
Initialization of Array

Statement C Program: This Program illustrates the Initialization of Five integers to the corresponding elements of a 1-D Array.

#include<stdio.h>
#include<conio.h>
void main()
{
int marks [ ] = {20 , 40 , 60 , 80 , 55 , 95};
int i;

read more

WAP of C Language to Find the Largest Element of an Array

Engg.... | 00:21 | | Best Blogger Tips
Flow Chart

Statement of C Program: This Program prints the Largest element of an Array:

#include<stdio.h>
#include<conio.h>
#define MAX 6                      
void main()
{
float a[MAX] , large;
int i;
clrscr();

read more

WAP of C Language that Sorts the Elements of Array in Ascending Order

Engg.... | 00:25 | | Best Blogger Tips
Sorted Array

Statement of C Program: This Program arranges a set of floating-point numbers in an ascending order and prints them:

#include<stdio.h>
#include<conio.h>
void main()
{
float array[20];
int i, j, n, temp;
clrscr();
printf(" Enter the size of an Array\n");
scanf("%d" , &n);

read more

Detailed Overview of One-Dimensional Array of C Language [Tutorial]

Engg.... | 22:36 | | Best Blogger Tips
One-Dimensional Array




                                                        1-Dimensional Array:                                                    


It is a linear list of fixed number of data items of the same type. All these data items are accessed using the same name using a single subscript. It is similar to a row or column matrix. It is also called as a single-dimensional Array or one subscripted variable.


                                                              Declaration:                                                             


The syntax of declaring a one-dimensional Array is as follows:


  data_type arrayname [size];  


where
arrayname => name of the Array.
size => number of elements of same data type.

read more

Write a C Program to Find the Average Marks obtained by a class of 30 Students in a Test

Engg.... | 02:16 | | Best Blogger Tips
Average Marks

Statemant of C Program: This Program accepts the Marks obtained by 30 Students of a Class in a Test and Compute the Average Marks:  

#include<stdio.h>
#include<conio.h>
void main()
{
int i;
int Avg;
int maks[40];                                                         /* Array Declaration */


read more

WAP of C Language that accepts the size of Array and Stores the Element in num Array

Engg.... | 00:48 | | Best Blogger Tips
Array

Statement of C Program: This Program accepts n Integers and stores them in an Array called num. It also prints them:

#include<stdio.h>
#include<conio.h>
void main()
{
int num[20];
int n , i ;
clrscr();
printf(" Enter the size of an Array\n");
scanf("%d" , &n);

read more

Detailed Discription of C Language Array [Tutorial]

Engg.... | 00:01 | | Best Blogger Tips
Array



                                                            Introduction:                                                             


There are many Applications which require to process a group of Data items that are of same type such as double , float , int or char.
For example:
we can define an Array of a list of marks obtained in an Examination by a group of Students. In such a situation, it is necessary to have a unique variable which holds a group of elements.



                                                               Definition:                                                              

  • Array is a group of Homogeneous data type elements, that consumes a continous Memory Area.
  • Array is used for Multiple inputs in a single variable.
  • An Array is a Data structure which stores a group of elements of the same kind.
  • Array can also be defined as an ordered list of Homogenous data elements.
read more

WAP to Calculate the Division of a Student as Per the given Rules of Tabel:

Engg.... | 00:26 | | Best Blogger Tips
The marks obtained by a student in 5 different subjects are Input through the Keyboard at the Run Time. The student gets a Division as per the given Rules:

Division Tabel

Statement of C Program: Write a program to Calculate the Division obtained by the Student:

#include<stdio.h>
#include<conio.h>
void main()
{
int s1 , s2 , s3 , s4 , s5 , Percent;
clrscr();
printf(" Enter marks of student in 5 subjects");
scanf(" %d%d%d%d%d" , &s1 , &s2 , &s3 , &s4 , &s5);

read more

WAP to Calculate the sum of given Series by using do-while loop or Statement

Engg.... | 23:55 | | Best Blogger Tips
Statement of C Program: This Program prints the sum of the following Series:

Mathematical Series

#include<stdio.h>
#include<conio.h>
void main()
{
int n , sign , term_cont;
float term , num , den , sum;
clrscr();
sum=0;
printf(" Enter the number of terms in the series\n");

read more

Difference Between an Integer , short and long Variables

Engg.... | 01:37 | | Best Blogger Tips
Int , short , long

Primary Data Types themselves could be of several types. For example, a char could be an unsigned char or a signed char. Or an int could be a short int or long int. Due these variations in the primitive data types, its very difficult to understand the concept. So let us take a closer look at these variations of primary data types in the tutorial:

=> Integers , long and short:
  • The range of an integer constant depends upon the compiler.
  • For a 16 bit Compiler like Turbo C or Turbo C++ the range is -32768 to 32767. 
  • For a 32 bit compiler like Visual Studio or gcc the range would be -2147483648 to 2147483647.
  • C offers a variation of the Integer data type i.e short and long integer values. 
  • The intention of providing these variations is to provide Integers with different ranges whenever possible. 
 

read more

Write a Program to Calculate the salary of an Employee as per the following Tabel:

Engg.... | 00:30 | | Best Blogger Tips


  Gender Years of Service Qualifications   Salary
  Male      >=10Post-Graduate  15000
     >=10Graduate 10000
      <10Post-Graduate 10000
      <10Graduate  7000
 Female      >=10 Post-Graduate 12000
     >=10 Graduate   9000
      <10Post-Graduate  10000
      <10Graduate   6000


Statement of C Program: Calculate the Salary of an Employee by using the Above Tabel:

#include<stdio.h>
#include<conio.h>
void main()
{
char g;
int yos , qual , sal=0;
clrscr();
printf(" Enter Gender , Years of Service and Qualification ( G=0 , PG=1 ):");
                  /* G stands for Graduate and PG stands for Post-Graduate */
scanf("%c%d%d" , &g , &yos , &qual);

read more

Write a C Program by using Logical AND and OR Operator

Engg.... | 03:37 | | Best Blogger Tips
Logical Operators

Statement of C Program: This Program illustrates the logical ANDing and ORing operations:

#include<stdio.h>
#include<conio.h>
void main()
{
int a , b , c;
clrscr();
a = 4 , b = 3;

read more

WAP to Find the Number of Integers Divisible by 5 between Given Range of Values by using for Statement

Engg.... | 02:54 | | Best Blogger Tips
Number divisible by 5

Statement of C Program: WAP(Write a Program) to Find the Number of Integer Divisible by 5 between the given range N1 and N2 , where N1<N2 and are Integers. Also Find the Sum of all these Integer Numbers that are Divisible by 5.

#include<stdio.h>
#include<conio.h>
main()
{
int i , N1 , N2 , count = 0 , sum = 0;
clrscr();
printf(" Enter the values of N1 and N2\n");
scanf("%d%d" , &N1 , &N2);
printf(" Integers divisible by 5 are\n");

read more

Tutorial on Special Operators of C Language

Engg.... | 01:33 | | | Best Blogger Tips
Special Operators
Special Operators of C:
  1. Comma Operator
  2. Size of()
  3. Address Operator
  4. Dereferencing Operator
  5. Dot Operator
  6. Arrow Operator
Lets we have to Discuss Some Popular Special Operators of C:

read more

Write a C Program to Find the Roots of a Quadratic Equation by using if-else and else-if Statement

Engg.... | 00:31 | | Best Blogger Tips
Quadratic Equation

Statement of C Program: This Program finds all the Roots of a Quadratic Equation, for non-zero cofficients:

#include<stdio.h>
#include<conio.h>
#include<math.h>
main()
{
float A , B , C , root1 , root2;
float realp , imgp , disc;               
                                      /* realp stands for Real Part and imgp stands for Imaginary Part */
clrscr();
printf(" Enter the values of A , B and C\n");
scanf("%f%f%f" , &A , &B , &C);

read more

Write a C Program by using abs() , log 10() , pow() and exp() Functions:

Engg.... | 00:48 | | Best Blogger Tips
Math Functions

Statement of C Program: This Program illustrates the use of abs() , log 10() , pow() and exp() Functions:


                                              Did you check the following?                                                     
                  Write a C Program by using sqrt() , sin() , cos() and tan() Functions 


read more

Write a C Program by using sqrt() , sin() , cos() and tan() Functions

Engg.... | 00:26 | | Best Blogger Tips
Mathematical Functions
Mathematical Functions:
  1. C provides a large number of Library Functions which perform specific operations. 
  2. Mathematical functions are also included among these Library Functions. 
  3. C Mathematical Functions are defined in the Header File math.h.
Statement of C Program: This Program illustrates the use of sqrt() , sin() , cos() and tan() Functions:

read more

C Program: Make a Calculator that Calculates Area of different Figures by using switch Statement

Engg.... | 02:32 | | Best Blogger Tips
Calculator

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
int fig_code;

float radius ;                                            /* For Circle */
float length , breadth ;                              /* For Rectangle */
float base , height ;                                   /* For Triangle */
float side ;                                               /* For Square */
float base1 , height1 ;                               /* For parallelogram */
float base2 , base3 , height2 ;                    /* For Trapezoid */
                                            

read more

Write a C Program that Accepts your Name and Prints it Desired Number of Times by using puts() and gets() Statements

Engg.... | 00:20 | | Best Blogger Tips
C Program

Statement of C Program: This Program accepts your name and prints it for the desired number of times


                                             Did you check the following?


read more

Overview of I/O Statements of C Language i.e puts() , gets() , getchar() and putchar() with Examples

Engg.... | 07:07 | | | Best Blogger Tips
Input_Output Statement

UnFormatted Input Statements:
These statements are primarily concerned with reading the character type data from the keyboard. 
The getchar() and gets() Functions are used for this purpose. Since, they are included in the stdio.h Header File, the C Program that uses these functions should exclusively have the following preprocessor statement :


   #include<stdio.h>  


read more

UnConditional And Loop Control Statements of C Language Part-2

Engg.... | 04:14 | | | | Best Blogger Tips
do-while loop

UNCONDITIONAL CONTROL STATEMENT:
  • C supports an unconditional control statement that is goto. 
  • goto is used to transfer control from one point to other in a C program.
  • Goto is a branching statement.
  • It requires a label. 
  • goto is a keyword.

read more

Conditional Control Statements of C and C++ Language Part-1

Engg.... | 04:10 | | | Best Blogger Tips
conditional statement

CONDITIONAL CONTROL STATEMENTS:
  • Conditional Control Statements involves performing a Logic Test. 
  • This Test results either a TRUE or FALSE.
Depending upon the truthness or falsity of the condition, the statememts to be executed is determined. After that, the control transfers to the statement in the program and start executing the statements. This is known as Conditional Execution.
In C four conditional control statements are widely used:
  1. If-statement
  2. If-else statement
  3. Nested-if-else statement
  4. Switch statement
Let us take all control statements one by one: 
 
 
read more

Write a C Program to Print The Given Number Pattern by using for Loop

Engg.... | 03:10 | | Best Blogger Tips
Number Pattern

Nested for Statement:
If one for statement is completely placed with in the other for Statement.

Remember:
  • One loop must completely be placed inside the other loop means no overlapping of loops.
  • Each loop must have different variables.
Statement of C Program: This Program Generates the Following Number Pattern :


read more

Write a C Program to Print the ASCII values of each Character of an Input String

Engg.... | 01:36 | | | Best Blogger Tips
ASCII Values

Basic Intro About ASCII Values:


char is a keyword used to indicate the Character Type Data. The Data may be a Character constant or String Constant. 
  1. A Character Constant may be defined as any single Character enclosed with in a pair of apostrophes. Examples : 'a' , 'd' , 'g' etc. 
  2. A string constant is defined as a sequence of characters placed between double quotes. Examples : "Computer" , "system" , "hello" etc. The string constant is terminated by a null character (\0).

read more

Tutorial on Basic Concepts of C++ Program Part 2

Engg.... | 00:52 | | Best Blogger Tips
C++

 iostream File:



   #include<iostream.h>  

  1. The Header File iostream should be included at the beginning of all Programs. 
  2. It contains declarations for the identifiers Cout , Cin and the << , >> Operators. 
  3. Some old versions of C++ use a Header File called iostream.h
  4. We should use iostream.h if the compiler does not support ANSI C++ Feature.
  5. If the compiler support ANSI C++ Feature then we use iostream .


   #include<iostream>  


read more