c++ program || code in c++ || c++ code for practice

 

for checking the ascii value for a to z;

#include<iostream>
using namespace std;
int main(){
   
    for(int i='a';i<'z';i++){
        cout<<i<<endl;
       }
    return 0;

}

write a program for goto function

#include<iostream>
using namespace std;
 int main(){
 // program for goto
 int x ;
cout<<"enter the value of x";
 cin>>x;
 if(x<90){
 goto p; //goto condition
 p:
 cout<<"x is less than 90";
 }
 else
 cout<<"defult";
 return 0;
 }

program in c++ for modulas of a function 


#include<iostream>
using namespace std;
 int main(){
 int x;
 cin>>x;
 if (x>0)
 cout<<x;
else
cout<<-x;
 return 0;
}

Comments