اكتب برنامج C لقراءة وطباعة عناصر مصفوفة طولها 7 ، قبل الطباعة استبدل كل رقم سالب ، و العدد (0) ب 100
- برمجة
- برمجة سي c
- 2021-05-02
- Wassim
الأجوبة
/*Write a C program to read and print the elements of an array of length 7, before print replace every negative number, zero with 100*/
#include <stdio.h>
int main() {
int n[5], i, x;
printf("Input the 5 members of the array:\n");
for(i = 0; i < 5; i++)
{
scanf("%d", &x);
if(x>0)
{
n[i] = x;
}
else
{
n[i] = 100;
}
}
printf("Array values are: \n");
for(i = 0; i < 5; i++) {
printf("n[%d] = %d\n", i, n[i]);
}
return 0;
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال