Write a program that calculates the number of digits of an integer N entered by the user. for Example N = 10843
the number of digits is : 5
******** In Algorithm ********
Algorithm Variables i,N,n : integers Begin write("Enter an integer : ") read(N) i ← 1 while (N / 10 ≠ 0) N ← N / 10 i ← i+1 next write("the number of digits is ",i) End Result ==> Enter an integer : 5187643 the number of digits is 7
******** In C ********
#include<stdio.h> int main(){ int i=1,N,n; printf("Enter an intrger : "); scanf("%d",&N); n=N; while(n/10 != 0){ n=n/10; i=i+1; } printf("the number of digits is %d",i); return 0 ; }
******** In C++ ********