C Plus Plus (Area and Parimeter)

#include
#include

using namespace std;

main(){
int length, width, parimeter, area;

cout<<"Length = "; cin>>length;
cout<<"Width = "; cin>>width;

parimeter = 2 * (length-width);
area = length*width;

cout<<<"Parimeter is "<
cout<<<"Area is "<

getch();

}

4 comments:

michel said...

http://img1.jurko.net/wall/uploads/wallpaper_8267.jpg


http://wallpapers.free-review.net/19__Windows_XP_Titanic.htm


http://www.fantom-xp.com/wallpapers/19/Microsoft_Windows_XP_Gold.jpg

Anonymous said...

perimeter not parimeter

amb said...

#include stdio h
#include stdlib h

int eo ( const void *a, const void *b )
{
int ia = *(int *)a;
int ib = *(int *)b;

if ( ia % 2 == 0 && ib % 2 != 0 )
return -1;
else if ( ia % 2 != 0 && ib % 2 == 0 )
return +1;
else
return 0;
}

int main ( void )
{
int a[] = {1,2,3,4,5,6,7,8,9,0};
int i;

for ( i = 0; i < 10; i++ )
printf ( "%d ", a[i] );
printf ( "\n" );
qsort ( a, 10, sizeof ( int ), eo );
for ( i = 0; i < 10; i++ )
printf ( "%d ", a[i] );
printf ( "\n" );

return 0;
}

michel bb said...

#include stdio h
#include conio h
main()
{
int a[12],b[12],c[12],i,j=0,k=0;

printf("Enter 12 numbers\n");
for(i=0;i<12;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<12;i++)
{
if((a[i]%2)==0)
{
b[j]=a[i];
j++;
}
else
{
c[k]=a[i];
k++;
}
}
printf("The even numbers are\n");
for(i=0;i "<" j;i++)
{
printf("%d\n",b[i])
}
printf("The odd numbers are\n")
for(i=0;i"<"k;i++)
{
printf("%d\n",c[i])
}
getch();
}












_______________________________________________




#include iostream
#include conio h

using namespace std;


main(){

int num[5]={10,20,30,40,50};
int oddSum=0, evenSum=0;

for(int x=0;x<5;x++){
if((x%2)==0){
evenSum+=num[x];

}
else
oddSum+=num[x];

}

cout<<"Odd Sum: " 'oddSum endl;
cout<<"Even Sum: "evenSum endl;
system("pause");

}

Post a Comment