Tuesday, 19 March 2013

diamond shape in c/c++

We will now post some shapes using c/c++ language.It will be defiantly helpful.If you need some more code for different kinds of shape then please email us-cprogtec@gmail.com
code----
#include<stdio.h>

int main(){
int i,j,n;
printf("put the size of the diamond");
scanf("%d",&n);
for(i=n;i>=1;i--){
for(j=1;j<=i;j++){
printf(" ",j);
}
for(j=0;j<=(n-i)*2;j++){
printf("*");
}
for(j=i;j>=1;j--){
printf(" ",j);
}
printf("\n");
}
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf(" ",j);
}
for(j=0;j<=(n-i)*2;j++){
printf("*");
}
for(j=i;j>=1;j--){
printf(" ",j);
}
printf("\n");
}

return 0;
}


Monday, 18 March 2013

range of char data type

we all know about char data type.char data type has a limit and is 0 to 255.If you want to remember all the char  then it will be vary difficult. But if you learn through a program about  this data type the it would be very easy for.So here is a program showing all the char-------------------
#include<stdio.h>
int main()
{
  
    int i,n,a,z,b,c;

printf("List of CHARACTER");
    for(i=0;i<=255;i++){
    printf("%c %d\n",i,i);
    }

}

if you have any problem then ask us.ou email id-cprogtec@gmail.com.please visit c programming and technology .
give comment also.