top of page

Updated: Feb 8, 2023



#include <stdio.h>


void main() {

char s[100]="12345123456789678900";

int c=0,c0=0,i=0,c1=0,c2=0,c3=0,c4=0,c5=0,c6=0,c7=0,c8=0,c9=0;

printf("\nString : %s\n",s);

for(i=0;s[i]!='\0';i++)

{

if((s[i]=='0')||(s[i]=='1')||(s[i]=='2')||(s[i]=='3')||(s[i]=='4')||(s[i]=='5')|| (s[i]=='6')||(s[i]=='7')||(s[i]=='8')||(s[i]=='9'))

{

//printf("%c ",s[i]);

if(s[i]=='0')

{

c0 = c0 + 1;

}

if(s[i]=='1')

{

c1 = c1 + 1;

}

if(s[i]=='2')

{

c2 = c2 + 1;

}

if(s[i]=='3')

{

c3 = c3 + 1;

}

if(s[i]=='4')

{

c4 = c4 + 1;

}

if(s[i]=='5')

{

c5 = c5 + 1;

}

if(s[i]=='6')

{

c6 = c6 + 1;

}

if(s[i]=='7')

{

c7 = c7 + 1;

}

if(s[i]=='8')

{

c8 = c8 + 1;

}

if(s[i]=='9')

{

c9 = c9 + 1;

}

c=c+1;

}

}

printf("\nTotal digits : %d",c);

printf("\nZero : %d",c0);

printf("\nOne : %d",c1);

printf("\nTwo : %d",c2);

printf("\nThree : %d",c3);

printf("\nFour : %d",c4);

printf("\nFive : %d",c5);

printf("\nSix : %d",c6);

printf("\nSeven : %d",c7);

printf("\nEight : %d",c8);

printf("\nNine : %d",c9);

}

0 views0 comments

"#include" is a preprocessor directive in the C and C++ programming languages. It is used to include code from other files, typically library files, into the current file being compiled.


For example:

#include <stdio.h>

#include <conio.h>


This line tells the compiler to include the contents of the "stdio.h" and "iostream" library, which contains definitions for standard input and output operations.


In this context, angle brackets indicate that the file being included is part of the standard library, while quotes indicate that the file is part of the local project or a user-defined library.






#include <stdio.h>


int main() {

int n1=0,n2=1,temp;

int n,i;

printf("\nEnter the range : ");

scanf("%d",&n);

printf("\n%ld %ld ",n1,n2);

for(i=2;i<n;i++)

{

temp=n1+n2;

n1=n2;

n2=temp;

printf(" %ld",temp);

}

}

0 views0 comments
bottom of page