Sign in to follow this  
Cornel Iulian

[C] Transforma orele si minutele in secunde in C

1 post in this topic

Cerinta: Creati un program C care transforma orele si minutele in secunde.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	int ore,minute,secunde,rezultat;
	printf("Introduceti timpul in ore, minute si secunde:\n");
	if(scanf("%d%d%d",&ore,&minute,&secunde)!=3)
	{
		printf("Date eronate");
		exit(1);
	}
	rezultat=ore*3600+minute*60+secunde;
	printf("In total s-au obtinut %d secunde.",rezultat);
	return 0;
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this