C Programming Operators and Exercises - learnit

Home Top Ad

Post Top Ad

Wednesday, March 9, 2022

C Programming Operators and Exercises

C Programming Operators and Exercises

An operator is a symbol that performs a function on a value or variable. For example, + is an addition operator


C Arithmetic Operators


An arithmetic operator performs mathematical operations on numerical values (constants and variables) such as addition, subtraction, multiplication, and division.


Operator Meaning of Operator
+ addition or unary plus
- subtraction or unary minus
* multiplication
/ division
% remainder after division (modulo division)

Example and Exercises

#include
using namespace std;
int main()
{
int i,j,flg;
flg=0;
cout<<endl;
cout << " Find i Numbers between 1 to 1000:"<<endl;
cout << " ----------------------------------------"<<endl;
cout <<" The i numbers are: "<<endl;
for(i=1;i<=1000;i++)
{
j=i;
flg=0;
while(j>0)
{
if(j % 10==0)
{
flg=1;
break;
}
j/=10;
}
if(i>0 && flg==1)
{
cout <<i<<" ";
}
}
cout<<endl;
}

Please Watching My Video is Below

No comments:

Post a Comment

Post Top Ad