WAP to evaluate sqyare root of a series of a numbers and print the result. if number is negative, program should print a message and keeps on counting number of negative values entered by the user......


#include<math.h>
void main()
{
int no,i,c=0,d;
clrscr();
for(i=1; i<=4; i++)
{
printf("Enter the number");
scanf("%d", &no);
if(no<0)
{
  printf("\nNo. is negative");
c++;
continue;
}
else
{
d=sqrt(no);
  printf("\nsqroot=%d", d);
}
printf("\nNegative numbers= %d",c);
}
getch();
}

No comments:

Post a Comment