### Semantics and pragmatics

Oct 10,2017

**Algorithm or Pseudo-code**

Learn the flow of the algorithm. Consider x and y as two different values.

Write an algorithm to take 100 values in x and y respectively. Test x against y and display weather x is greater or y is greater, while comparing x and y. calculate total of x and y. Also, include average of x and y values. Test for odd and even in x and y. calculate total odd and even in x and y.

**Solution:**

Let x=0

Let y=0

For count = 1 to 100 [For: Repetition starts here]

Input x [input of x and y are taken]

Input y

If x is greater than y then

Print “X is greater than y”

Else [if condition started with else]

Print “Y is greater than x”

End if

**[Testing x for odd and even]**

If x=”odd” then

Xo=xo+1 [counting for total no of odd in x]

Else if x=”even” then

Xe=xe+1 [counting for total no of even in x]

End if

**[Testing y for odd and even]**

If y=”odd” then

Yo=yo+1 [counting for total no of odd in y]

Else if y=”even” then

Ye=ye+1 [counting for total no of even in y]

Eid if

Tx=tx+x [summing total values of x]

Ty=ty+y [summing total values of y]

Next count [For next loop/repetition ends here]

**[Calculating Average for total x and y values separately after the loop ends.]**

Avgx=tx/count [or 100] [calculating Avg for total x values]

Avgy=ty/count [or 100] [calculating Avg for total y values]

**[Showing output of all x and y status in the last.]**

Print “total of x ”, tx

Print “total of y ”, ty

Print “total x even ”, xe

Print “total x odd ”, xo

Print “total y even ”,ye

Print “total y odd”, yo

Print “Average of x”, Avgx

Print “Average of y”, Avgy

By Sabihuddin Ahmed Siddiqui

**Filed Under:**
Find X And Y Status.

The graph shows how relevant this story is on social networks real-time.

User Type: |
Tutor Verified |

Name: |
Sabihuddin |

Uploaded Date: |
Dec 22,2015 |

I am an IT Professional with rich experience of Programming languages such as Java/C#/C/C++ and website development. I have also gained teaching experience of O/AS/A level computer science and AICT. I have been working on Computer Applications on Java with Edupedia World. I also worked .... Read More