0% found this document useful (0 votes)
78 views6 pages

Bca (B3) Pds Assignment Harshit Singh Chauhan SAPID: 500097391

The document discusses different types of operators used in C programming such as assignment, relational, logical, bitwise, and arithmetic operators. It also provides examples of flowcharts and their uses. Additionally, it includes the code for a C program that prints even and odd numbers up to a user-entered value using a while loop, and another program that calculates power of a number using recursion.

Uploaded by

Harshit Chauhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views6 pages

Bca (B3) Pds Assignment Harshit Singh Chauhan SAPID: 500097391

The document discusses different types of operators used in C programming such as assignment, relational, logical, bitwise, and arithmetic operators. It also provides examples of flowcharts and their uses. Additionally, it includes the code for a C program that prints even and odd numbers up to a user-entered value using a while loop, and another program that calculates power of a number using recursion.

Uploaded by

Harshit Chauhan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

BCA (B3) PDS ASSIGNMENT

HARSHIT SINGH CHAUHAN


SAPID: 500097391

QUESTION 1:
Flowchart is a graphical representation of an algorithm. Programmers often use it as a program-
planning tool to solve a problem. It makes use of symbols which are connected among them to
indicate the flow of information and processing. 
The process of drawing a flowchart for an algorithm is known as “flowcharting”. Uses of
flowchart, 

 Flowcharts are better way of communicating the logic of system.


 Flowcharts act as a guide for blueprint during program designed.
 Flowcharts helps in debugging process.
 With the help of flowcharts programs can be easily analysed.
 It provides better documentation.
 Flowcharts serve as a good proper documentation.
QUESTION 2:
Assignment Operator-
An assignment operator is used for assigning a value to a variable. The most common assignment
operator is =
Operator Example Same as

= a=b a=b

+= a += b a = a+b

-= a -= b a = a-b

*= a *= b a = a*b

/= a /= b a = a/b

%= a %= b a = a%b
Relational operator-

A relational operator checks the relationship between two operands. If the relation is true, it returns
1; if the relation is false, it returns value 0.

Relational operators are used in decision making and loops.


Operator Meaning of Operator Example

== Equal to 5 == 3 is evaluated to 0

> Greater than 5 > 3 is evaluated to 1

< Less than 5 < 3 is evaluated to 0

!= Not equal to 5 != 3 is evaluated to 1

>= Greater than or equal to 5 >= 3 is evaluated to 1

<= Less than or equal to 5 <= 3 is evaluated to 0

Logical Operators-

An expression containing logical operator returns either 0 or 1 depending upon whether expression
results true or false. Logical operators are commonly used in decision making in C programming.
Operator Meaning Example

Logical AND. True only if all If c = 5 and d = 2 then, expression ((c==5) &&
&&
operands are true (d>5)) equals to 0.

Logical OR. True only if either one If c = 5 and d = 2 then, expression ((c==5) ||
||
operand is true (d>5)) equals to 1.

Logical NOT. True only if the


! If c = 5 then, expression !(c==5) equals to 0.
operand is 0

Bitwise Operators-
During computation, mathematical operations like: addition, subtraction, multiplication, division,
etc are converted to bit-level which makes processing faster and saves power.

Bitwise operators are used in C programming to perform bit-level operations.

Operators Meaning of operators

& Bitwise AND

| Bitwise OR

^ Bitwise exclusive OR

~ Bitwise complement

<< Shift left

>> Shift right

Arithmetic Operators-

An arithmetic operator performs mathematical operations such as addition, subtraction,


multiplication, division etc on numerical values (constants and variables).

Operator Meaning of Operator

+ addition or unary plus

- subtraction or unary minus

* multiplication

/ division

% remainder after division (modulo division)


QUESTION 3:
#include<stdio.h>
void main()
{
int n,last;
clrscr();
printf("\n Enter Last Number : ");
scanf("%d",&last);
printf("\n Even Number List :\n ");

n=2;
while(n<=last)
{
printf(" %d",n);
n=n+2;
}

printf("\n\n Odd Number List :\n ");

n=1;
while(n<=last)
{
printf(" %d",n);
n=n+2;
}

getch();

QUESTION 4:
#include<stdio.h>
  
int power(int a, unsigned int b)
{
    if (b == 0)
        return 1;
    else if (b%2 == 0)
        return power(a, b/2)*power(a, b/2);
    else
        return a*power(a, b/2)*power(a, b/2);
}
  
int main()
{
    int a = 2;
    unsigned int b = 3;
  
    printf("%d", power(a, b));
    return 0;
}

You might also like