1 12 123 1234 12345
#include<stdio.h> void main() { int i,j,n; printf("Enter the number of lines:"); scanf("%d",&n); for(i=1;i<=n;i++) { for(j=1;j<=i;j++) { printf("%d",j); } printf("\n"); } } The output would be Enter the number of lines:5 1 12 123 1234 12345
#include<stdio.h> main() { int i,j; for(i=1;i<6;i++) { for(j=1;j<=i;j++) printf("%d",j); printf("\n"); } }
for (a=1; a<=100; a++) printf ("%d\n", a * a);
1*8+1= 9 12*8+2=98 123*8+3=987 1234*8+4=9876 12345*8+5=98765 123456*8+6=987654 1234567*8+7=9876543 12345678*8+8=9876543 2 123456789*8+9=987654 321
Determine the set of inputs that will lead to SIGFPE (floating point exception) being triggered in following C program?
#include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { if(argc != 3 || !atoi(argv[2])) return 1; return abs(atoi(argv[1])) / atoi(argv[2]); }