/* Write a C programs to add two values using while loop */
#include<stdio.h>
int main() {
int num1 = 10, num2 = 5, i;
while (num2 > 0) {
num1++;
num2--;
}
printf("%d", num1);
return (0);
}
Output
---------
15
#include<stdio.h>
int main() {
int num1 = 10, num2 = 5, i;
while (num2 > 0) {
num1++;
num2--;
}
printf("%d", num1);
return (0);
}
Output
---------
15
No comments:
Post a Comment