Write a program  which allows the user to enter a series of integers ending in 0, and which displays at the end the number of occurrences of  5


******** In Algorithm ********

Algorithm Variables N,i : integers Begin i ← 0 do read(N) if( N = 5 ) then i ← i+1 next while (N <> 0) if ( i <> 0) then write("Number of 5 = ",i) else write("does not exist ") next End Result ==> 5 9 1 4 1 5 5 6 0 ( 5 ) exist 3 times

******** In C ********

#include<stdio.h> int main(){ int i=0,N; do{ printf("Enter an integer :"); scanf("%d",&N); if( N == 5 ) i = i+1 ; }while ( N != 0 ); if( i != 0) printf("Number of 5 = %d ",i); else printf(" does not exist "); return 0 ; }


******** In C++ ********

#include <iostream> using namespace std; int main(){ int i=0,N; do{ cout<<"Enter an integer :"; cin>>N; if( N == 5 ) i = i+1 ; }while ( N != 0 ); if( i != 0) cout<<"Number of 5 = "<<i ; else cout<<" does not exist "; return 0 ; }