#include<stdio.h>
#include<string.h>

main()  {
int n;
                char aan = 'y';




       while (aan == 'y')
       {
               printf("entr ") ;
               scanf ("%d", &n) ;
               printf("sq of %d is %d", n, n*n );
               scanf ("%c", &aan);
               printf("\n want aan y/n""\n");


       }
               }

I want to make this using while loop. kindly tell me the problem with it. ITs not working as i want...

Did you want it to add the numbers 7 and 4? Try this:

int x = 7+4;

If you wanted it to do something else, you'll have to tell us what you wanted it to do. If we have to magically guess what you want it to do, we will be guessing a long time.

use scanf("%c",&aan); twice in your code and see the result.;)

if we can know what is the expected out put
then it will be better for us to help you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.