1.7. Converting pseudo-code to programs.

1.7 CONVERTING PSEUDO-CODE TO PROGRAMS

·       Pseudocode uses Natural languages well as Programming language words and phrases. Pseudocodes are written with respect to programming languages. Pseudocode is a minimized version of algorithm. It is neither algorithm nor program.

·       Let's take an example of addition of two numbers.

Pseudocode

C Program

C++ Program

Start

Read a,b

sum=a+b

Print sum

Stop

#include<stdio.h>

void main()

{

   int a,b,sum;

   scanf(“%d%d”,&a,&b)

   sum=a+b;

   printf(“%d”,sum)

}

#include<iostream.h>

void main()

cin>>a,b,sum;

sum=a+b;

cout<<sum;

}

0 Comments:

Post a Comment