You are not logged in.

#1 2015-09-15 04:09:17

hasnain
Administrator
From: Chichawatni
Registered: 2014-10-13
Posts: 8,355
Website

Program User:

C Programming Quizzes C Language Control Structures

Directions:
What is the output of given program if user enter "xyz"?

Question:
#include<stdio.h>
void main()
{
    float age, AgeInSeconds;
    int value;
    printf("Enter your age:");
    value=scanf("%f", &age);
    if(value==0){
        printf("nYour age is not valid");
    }
    AgeInSeconds = 365 * 24 * 60 * 60 * age;
    printf("n You have lived for %f seconds", AgeInSeconds);
}

Option A):
None
Option B):
Enter your age: xyz You have lived for 0 seconds
Option C):
Enter your age: xyz Your age is not valid
Option D):
Complier error

Correct Answer is Option C):
Enter your age: xyz Your age is not valid


Failure is the first step towards seccess.

2015-09-15 04:09:17

Advertisement
Ads By Google

Re: Program User:



\n

Board footer