#include <stdio.h>
int main( )
{
int num, i, count;
printf(“\n ENTER A NUMBER : “);
scanf(“%d”,&num);
count = 0;
while(num != 0)
{
count++;
num /= 10;
}
printf(“\n The no of digits = %d”,count);
return 0;
}
In the above code, statement will be executed until the num equal to 0.
#include <stdio.h>
int main( )
{
int num, i, count;
printf(“\n ENTER A NUMBER : “);
scanf(“%d”,&num);
count = 0;
while(num != 0)
{
count++;
num /= 10;
}
printf(“\n The no of digits = %d”,count);
return 0;
}
In the above code, statement will be executed until the num equal to 0.
The C language is a high-level, general-purpose programming language. It provides a straightforward, consistent, powerful interface for programming systems. That's why the C language is widely used for developing system software, application software, and embedded systems.The C programming language has been highly influential, and many other languages have been derived from it.
While C is one of the easy languages, it is still a good first language choice to start with because almost all programming languages are implemented in it. It means that once you learn C language, it’ll be easy to learn more languages like C++, Java, and C#.
Understand the type of data that you are working with, such as whether it’s an integer or a character. C is based on data types, so understanding this characteristic is the foundation for writing programs that work well.Learn the operators. Operators are symbols that tell the compiler program what to do.
The break is a keyword in C which is used to bring the program control out of the loop. The break statement is used inside loops or switch statement. The break statement breaks the loop one by one, i.e., in the case of nested loops, it breaks the inner loop first and then proceeds to outer loops.
Copyrights © 2024 letsupdateskills All rights reserved