diff --git a/diamond_pattern.cpp b/diamond_pattern.cpp new file mode 100644 index 0000000..9bc8cc5 --- /dev/null +++ b/diamond_pattern.cpp @@ -0,0 +1,34 @@ +#include +#include +using namespace std; +int main() +{ + int i,j,k,m=5; + //message to be displayed on screen + cout<<"Enter a character"<>ch; + cout<<"The required pattern:"<=1;i--) + { + for(j=1;j<=m;j++) + cout<<" "; + for(k=1;k<=i;k++) + cout< +#include +using namespace std; + int dd=0,mm=0,yy=0; + int jd=0; + + int fnleap() + { + cout<<"Enter day:"<>dd; + cout<<"Enter month:"<>mm; + cout<<"Enter year:"<>yy; + if(yy%4==0) + return(1); + else + return(0); + } + int fnisvalid() + { + if(dd<1||dd>31) + return(0); + if(mm<1||mm>12) + return(0); + if(yy<1) + return(0); + else + return(1); + } + int main() + { + int endm[]={31,29,31,30,31,30,31,31,30,31,30,31}; + if(fnleap()==0) + endm[1]=28; + int r=0; + int p=fnisvalid(); + if(p==0) + { + cout<<"INVALID INPUT !!!!"< +#include +using namespace std; +int sum(int n) + { + int m=n,d=0; + int s=m*m; + //while loop begins to count the number of digits + while(n!=0) + { + d++; + n=n/10; + } + int a=s%(int)pow(10,d); + int b=s/(int)pow(10,d); + int su=a+b; + return(su); + } + int main() + { + int k=0,num,m; + cout<<"Enter the upper and lower limits :"<>num>>m; + //displaying the reasult + cout<<"The kaprekar numbers within "<