Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int temp, cneg, cpos, ctpos=0, ctneg=0;
- for (int i=0; i<18; i++){
- printf ("Ingrese una temperatura distinta de 0:");
- scanf ("%d", &temp);
- if (temp>0){
- cneg=0;
- cpos++;
- if (cpos>2){
- ctpos++;
- }
- }
- else{
- cpos=0;
- cneg++;
- if (cneg>2){
- ctneg++;
- }
- }
- }
- printf ("Se ingresaron %d ternas positivas y %d ternas negativas", ctpos, ctneg);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement