Post has attachment
|| C PROGRAM TO PRINT THE HEART SHAPE AS GIVEN IN PICTURE ||
#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int a, b, c;
printf("Enter size of heart(<20): \n");
scanf("%d",&c);
for (a=0; a<c; a++)
{
for (b=0; b<=4*c; b++)
{
int d = sqrt( pow(a-c,2) + pow(b-c,2) );
int e = sqrt( pow(a-c,2) + pow(b-3*c,2) );
if (d < c + 0.5 || e < c +0.5 )
printf("*");
else
printf(" ");
}
printf("\n");
}
for (a = 1; a <= 2*c; a++)
{
for (b=0; b<a; b++)
printf(" ");
for (b=0; b<4*c + 1 - 2*a; b++)
printf("*");
printf("\n");
}
return 0;
}
#BIKASH
Post has attachment
|| C PROGRAM TO FIND OUT THE LARGEST AND SMALLEST NUMBER FROM GIVEN NUMBERS IN ARRAY ||
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],l,i,n,s;
printf("enter the limit n:\n");
scanf("%d",&n);
printf("enter the numbers:\n");
for(i=0;i<=n;i++)
{
scanf("%d",&a[i]);
}
l=a[0];
s=a[0];
for(i=0;i<=n;i++)
{
if(l<a[i])
{
l=a[i];
}
else if(s>a[i])
{
s=a[i];
}
}
printf("the largest number is %d ",l);
printf("\nthe smallest number is %d",s);
}
Post has attachment
|| PROGRAM TO CHECK WEATHER GIVEN STRING IS PALINDROME OR NOT ||
‪#‎include‬<stdio.h>
#include<conio.h>
void main()
{
char word[10],word1[10];
printf("enter the string\n");
gets(word);
strcpy(word1,word);
if(strcmp(strrev(word),word1)==0)
{
printf("%s is palindrome\n",word1);
}
else
{
printf("%s is not palindrome\n",word1);
}
getch();
}
Post has attachment
Now programmers are in google plus