0% found this document useful (0 votes)
138 views1 page

Iosp 1

This code prompts the user to input values for strength, intelligence, and speed. It then checks the inputs are valid before displaying the values and calculating the sum. Based on the sum or individual values, it outputs that the user is either a wizard, clever, or commoner.

Uploaded by

harini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views1 page

Iosp 1

This code prompts the user to input values for strength, intelligence, and speed. It then checks the inputs are valid before displaying the values and calculating the sum. Based on the sum or individual values, it outputs that the user is either a wizard, clever, or commoner.

Uploaded by

harini
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

int main(int argc,char*argv[])

{
@autoreleasepool
{
int strength,inteligence,speed,sum;
NSLog(@"enter strength:");
scanf("%i",&strength);
NSLog(@"enter intelligence:");
scanf("%i",&intelligence);
NSLog(@"enter speed:");
scanf("%i",&speed);
while(strength>10||strength<1)
{
NSLog("give correct input");
NSLog(@"enter strength:");
scanf("%i",&strength);
NSLog(@"enter intelligence:");
scanf("%i",&intelligence);
NSLog(@"enter speed:");
scanf("%i",&speed);
}
NSLog(@"input is: %i strength %i intelligence %i
speed",strength,inteligence,speed);
sum=strength+intelligence+speed;
if(sum==30)
{
NSLog("you are a wizard");
}
else if(strength>=8&&intelligence>=8&&(strength+intelligence)/2>7)
{
NSLog("you are clever");
}
else
{
NSLog("you are a commoner");
}
}
return 0;
}

You might also like